26 #include <Classes.hpp>
27 #include <Controls.hpp>
28 #include <StdCtrls.hpp>
30 #include <Buttons.hpp>
31 #include <ExtCtrls.hpp>
33 #include <Dialogs.hpp>
34 #include <Graphics.hpp>
35 #include <ComCtrls.hpp>
58 #include <Filectrl.hpp>
61 #include <Vcl.HTMLHelpViewer.hpp>
62 #pragma package(smart_init)
63 #pragma link "Vcl.HTMLHelpViewer" //added at v2.0.0 for access to the .chm help file
64 #pragma resource "*.dfm"
83 Screen->Cursor = TCursor(-11);
149 "program operation may be restricted");
159 Application->HelpFile = AnsiString(
CurDir +
"\\Help.chm");
167 int DispW = (Screen->Width - 64) / 16;
168 int DispH = (Screen->Height - 192) / 16;
172 Display =
new TDisplay(
MainScreen,
PerformanceLogBox,
OutputLog1,
OutputLog2,
OutputLog3,
OutputLog4,
OutputLog5,
OutputLog6,
OutputLog7,
OutputLog8,
309 SpeedButton96->Glyph->LoadFromResourceName(0,
"ConcourseGlyph");
373 FontButton->Glyph->LoadFromResourceName(0,
"FontGraphic");
374 HomeButton->Glyph->LoadFromResourceName(0,
"Home");
393 SetGapsButton->Glyph->LoadFromResourceName(0,
"ConnectGaps");
404 CallOnImage->Picture->Bitmap->LoadFromResourceName(0,
"CallingOn");
405 CrashImage->Picture->Bitmap->LoadFromResourceName(0,
"CrashWarning");
406 DerailImage->Picture->Bitmap->LoadFromResourceName(0,
"DerailWarning");
407 SignalStopImage->Picture->Bitmap->LoadFromResourceName(0,
"SignalStopWarning");
408 SPADImage->Picture->Bitmap->LoadFromResourceName(0,
"SPADWarning");
409 TrainFailedImage->Picture->Bitmap->LoadFromResourceName(0,
"TrainFailedWarning");
411 DistanceKey->Picture->Bitmap->LoadFromResourceName(0,
"DistanceKey");
412 PrefDirKey->Picture->Bitmap->LoadFromResourceName(0,
"PrefDirKey");
414 TrackLinkedImage->Picture->Bitmap->LoadFromResourceName(0,
"TrackLinkedGraphic");
416 GapsNotSetImage->Picture->Bitmap->LoadFromResourceName(0,
"GapsNotSetGraphic");
417 GapsSetImage->Picture->Bitmap->LoadFromResourceName(0,
"GapsSetGraphic");
441 AnsiString NL =
'\n';
442 const AnsiString TTLabelStr1 =
"Start new train" + NL +
"Start new service from a split" + NL +
"Start new service from another service" + NL +
443 "Start new non-repeating shuttle finish service" + NL +
"Start new shuttle train at a timetabled stop" + NL +
444 "Start new shuttle service from a feeder";
446 const AnsiString TTLabelStr2 =
"Pass" + NL +
"Be joined by another train" + NL +
"Front split" + NL +
"Rear split" + NL +
"Change direction of train";
448 const AnsiString TTLabelStr3 =
"Finish && form a new service" + NL +
"Finish && join another train" + NL +
"Finish && exit railway" + NL +
449 "Finish && repeat shuttle, finally remain here" + NL +
"Finish && repeat shuttle, finally form a finishing service" + NL +
450 "Finish non-repeating shuttle feeder service" + NL +
"Finish && remain here";
452 const AnsiString TTLabelStr4 =
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
453 "HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
"HH:MM" + NL +
" " + NL +
"R";
455 const AnsiString TTLabelStr5 =
"HH:MM ';' Location" + NL +
"HH:MM ';' HH:MM ';' Location";
457 const AnsiString TTLabelStr6 =
"+ rear element ID - space - front element ID [+ optional ';S']" + NL +
"+ ref. of the train that splits" + NL +
458 "+ other service ref." + NL +
"+ shuttle service ref." + NL +
"+ rear element ID - space - front element ID ';' linked shuttle ref." + NL +
459 "+ linked shuttle service ref. ';' feeder service ref." + NL +
"+ location" + NL +
"+ joining train ref." + NL +
"+ new service ref." + NL +
460 "+ new service ref." + NL +
" " + NL +
"+ new service ref." + NL +
"+ ref. of train to join" + NL +
461 "+ list of valid exit element IDs (at least 1) separated by spaces" + NL +
"+ linked shuttle service ref.";
463 const AnsiString TTLabelStr7 =
"Arrival OR departure time (program will determine which from the context) + location." + NL +
464 "Arrival time, departure time (with no events between) + location";
466 const AnsiString TTLabelStr9 =
"Timetable entries" + NL +
"(service references etc.)";
467 const AnsiString TTLabelStr11 =
"Timetable" + NL +
"start time";
469 const AnsiString TTLabelStr12 =
"NB: WITHIN SERVICES commas must" + NL +
"not be used (have special meanings)," + NL +
470 "and semicolons may only be used to" + NL +
"separate service components.";
472 const AnsiString TTLabelStr13 =
"+ linked shuttle service ref. ';' finishing service ref." + NL +
"+ linked shuttle service ref.";
474 const AnsiString TTLabelStr15 =
"Repeat the service + ';' minutes between repeats ';' digit increment ';' number of repeats (last line of service)";
491 AnsiString ColourStr =
"";
492 std::ifstream ColFile((
CurDir +
"\\Background.col").c_str());
503 else if((ColourStr !=
"white") && (ColourStr !=
"black") && (ColourStr !=
"blue"))
509 if(ColourStr ==
"white")
513 else if(ColourStr ==
"blue")
526 AnsiString RHSigStr =
"";
527 std::ifstream SignalFile((
CurDir +
"\\Signal.hnd").c_str());
528 if(SignalFile.fail())
530 SigImagePanel->Caption =
"Signals will be on the left hand side of the track";
536 std::ofstream SignalFile((
CurDir +
"\\Signal.hnd").c_str());
537 if(!SignalFile.fail())
547 if(RHSigStr ==
"RHSignals")
559 SigImagePanel->Caption =
"Signals will be on the right hand side of the track";
569 SigImagePanel->Caption =
"Signals will be on the left hand side of the track";
575 std::ofstream SignalFile((
CurDir +
"\\Signal.hnd").c_str());
576 if(!SignalFile.fail())
594 std::ifstream SplashFile((
CurDir +
"\\GNU").c_str());
595 if(SplashFile.fail())
598 "This program is free software released under the terms of the GNU General Public License Version 3, as published by the Free Software Foundation. It may be used or redistributed in accordance with that license and is released in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details - you should have received a copy along with this program but if not see <http://www.gnu.org/licenses/>.");
599 std::ofstream SplashFile((
CurDir +
"\\GNU").c_str());
600 if(!SplashFile.fail())
604 if((Screen->Width < 1024) || (Screen->Height < 768))
606 ShowMessage(
"Please note that this program works best with a screen resolution of at least 1024 x 768. Please change if possible");
612 WindowState = wsMaximized;
624 Screen->Cursor = TCursor(-2);
649 char *LocalNumericInformation = setlocale(LC_NUMERIC,
"");
651 if(LocalNumericInformation ==
"")
656 struct lconv *conv = &Locale;
662 catch(
const EFOpenError &e)
666 MessageDlg(e.Message +
" - program must terminate", mtError, But, 0);
667 Application->Terminate();
670 catch(
const Exception &e)
674 AnsiString Message =
"A fatal error occurred during the program setup process, the program must terminate. Message = " + e.Message;
675 MessageDlg(Message, mtError, But, 0);
677 Application->Terminate();
706 catch(
const Exception &e)
722 catch(
const Exception &e)
741 Screen->Cursor = TCursor(-2);
751 Screen->Cursor = TCursor(-2);
758 catch(
const Exception &e)
775 catch(
const Exception &e)
788 UnicodeString strVersion = L
"N/A";
790 VersionSize = GetFileVersionInfoSizeW(Application->ExeName.c_str(), &VersionHandle);
793 pBuffer =
new BYTE[VersionSize];
795 if(GetFileVersionInfoW(Application->ExeName.c_str(), VersionHandle, VersionSize, pBuffer))
797 VS_FIXEDFILEINFO *fi;
801 if(VerQueryValueW(pBuffer, L
"\\", (
void**)&fi, &buflen))
804 strVersion.sprintf(L
"%d.%d.%d", HIWORD(fi->dwFileVersionMS), LOWORD(fi->dwFileVersionMS), HIWORD(fi->dwFileVersionLS)
813 return L
" v" + strVersion;
829 catch(
const Exception &e)
848 catch(
const Exception &e)
861 if(((TSpeedButton*)Sender)->Down)
873 catch(
const Exception &e)
907 ShowMessage(
"Incomplete track or other error - see inverted element (may be behind this message)");
918 ShowMessage(
"Unable to set any track links");
931 ShowMessage(
"Successful Completion");
947 catch(
const Exception &e)
968 catch(
const Exception &e)
987 catch(
const Exception &e)
1006 catch(
const Exception &e)
1025 TFont *TempFont =
new TFont;
1033 TempText.
Font = DisplayFont;
1040 else if(Key ==
'\x1B')
1046 catch(
const Exception &e)
1065 catch(
const Exception &e)
1080 ShowMessage(
"Error, location name being entered without an entry in LNPendingList");
1100 Screen->Cursor = TCursor(-11);
1102 AnsiString ExistingName;
1109 UnicodeString MessageStr = UnicodeString(
"Another location named '") +
LocationNameTextBox->Text +
1110 UnicodeString(
"' already exists. If you continue its name will be erased. Do you wish to continue?");
1111 int button = Application->MessageBox(MessageStr.c_str(), L
"Warning!", MB_YESNO | MB_ICONWARNING);
1115 Screen->Cursor = TCursor(-2);
1126 bool UseExistingPosition =
false;
1133 if(ExistingName !=
"")
1136 UseExistingPosition =
true;
1139 Screen->Cursor = TCursor(-2);
1153 bool UseExistingPosition =
false;
1155 UseExistingPosition =
true;
1158 Screen->Cursor = TCursor(-2);
1170 LocStr = LocStr.Trim();
1179 if((LocStr !=
"") && (LocStr[1] >=
'0') && (LocStr[1] <=
'9'))
1181 Screen->Cursor = TCursor(-2);
1182 ShowMessage(
"Location name can't begin with a number");
1190 if(LocStr.Length() > 50)
1192 Screen->Cursor = TCursor(-2);
1193 ShowMessage(
"Location name too long, 50 characters maximum");
1201 for(
int x = 1; x <= LocStr.Length(); x++)
1203 char Ch = LocStr[x];
1204 if((Ch !=
' ') && (Ch !=
'&') && (Ch !=
'(') && (Ch !=
')') && (Ch !=
':') && (Ch != 39) && (Ch !=
'.') && (Ch !=
'-') && (Ch !=
'+') &&
1205 (Ch !=
'/') && ((Ch <
'0') || (Ch >
'9')) && ((Ch <
'A') || (Ch >
'Z')) && ((Ch <
'a') || (Ch >
'z')))
1207 Screen->Cursor = TCursor(-2);
1209 "Location name contains one or more invalid characters, must be alphanumeric, brackets, space, full stop, colon, inverted comma, '-', '+', '/' or '&&'");
1220 Screen->Cursor = TCursor(-2);
1221 ShowMessage(
"Location name cannot be 'cdt', this name would interfere with the timetable");
1232 bool UseExistingPosition =
false;
1233 if(ExistingName !=
"")
1236 UseExistingPosition =
true;
1239 Screen->Cursor = TCursor(-2);
1248 Screen->Cursor = TCursor(-2);
1251 catch(
const Exception &e)
1272 catch(
const Exception &e)
1285 int Dist = 0, SpeedLimit = 0;
1288 DistanceStr =
"No change";
1291 SpeedStr =
"No change";
1294 if(DistanceStr ==
"No change")
1296 if(SpeedStr ==
"No change")
1306 if(((Dist != -1) && (DistanceStr.Length() > 6)) || ((SpeedLimit != -1) && (SpeedStr.Length() > 6)))
1308 ShowMessage(
"One or more entries too long");
1312 if((DistanceStr ==
"") || (SpeedStr ==
""))
1314 ShowMessage(
"One or more entries blank");
1320 for(
int x = 1; x <= DistanceStr.Length(); x++)
1322 if((DistanceStr[x] <
'0') || (DistanceStr[x] >
'9'))
1324 ShowMessage(
"Track length value must be a positive whole number, or blank for no change");
1332 for(
int x = 1; x <= DistanceStr.Length(); x++)
1334 if((DistanceStr[x] <
'0') || (DistanceStr[x] >
'9'))
1336 ShowMessage(
"Distance must be a positive whole number");
1344 for(
int x = 1; x <= SpeedStr.Length(); x++)
1346 if((SpeedStr[x] <
'0') || (SpeedStr[x] >
'9'))
1348 ShowMessage(
"Speed limit must be a positive whole number, or blank for no change");
1356 for(
int x = 1; x <= SpeedStr.Length(); x++)
1358 if((SpeedStr[x] <
'0') || (SpeedStr[x] >
'9'))
1360 ShowMessage(
"Speed limit must be a positive whole number, or 'Mixed'");
1367 Dist = DistanceStr.ToInt();
1368 if(SpeedLimit != -1)
1369 SpeedLimit = SpeedStr.ToInt();
1377 if(((Dist != -1) && (Dist < 20)) || ((SpeedLimit != -1) && (SpeedLimit < 10)) || ((SpeedLimit != -1) && (SpeedLimit >
TTrain::MaximumSpeedLimit)))
1380 ShowMessage(
"Lengths must be 20m or more, and speeds must be between 10km/h and 400km/h");
1393 bool NamedLocPresent =
false;
1396 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
1398 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
1401 NamedLocPresent =
true;
1405 if(NamedLocPresent && (Dist < 50))
1407 ShowMessage(
"Note: Named location elements are quite short. If they are too short the simulation might depart too far from reality.");
1410 if(NamedLocPresent && (Dist > 200))
1412 ShowMessage(
"Note: Named location elements are quite long. If they are too long the simulation might depart too far from reality.");
1415 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
1417 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
1454 catch(
const Exception &e)
1477 catch(
const Exception &e)
1489 TMsgDlgButtons Buttons;
1490 Buttons << mbYes << mbNo;
1491 if(MessageDlg(
"This will reset the selected elements to default lengths & speed limits. Proceed?", mtWarning, Buttons, 0) == mrNo)
1509 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
1511 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
1565 throw Exception(
"Error, XLinkPos > 1 in SetOneDefaultTrackLength at " + AnsiString(TrackElement.
HLoc) +
" & " +
1566 AnsiString(TrackElement.
VLoc));
1582 catch(
const Exception &e)
1594 TMsgDlgButtons Buttons;
1595 Buttons << mbYes << mbNo;
1596 if(MessageDlg(
"This will reset ALL track elements to default lengths & speed limits. Proceed?", mtWarning, Buttons, 0) == mrNo)
1617 catch(
const Exception &e)
1645 bool GraphicFoundInVector =
false;
1646 for(TTrack::TUserGraphicVector::iterator UGVIt =
Track->
UserGraphicVector.begin(); UGVIt < Track->UserGraphicVector.end(); UGVIt++)
1648 if(UGMIt->first == UGVIt->FileName)
1650 GraphicFoundInVector =
true;
1654 if(!GraphicFoundInVector)
1656 delete UGMIt->second;
1672 catch(
const Exception &e)
1712 catch(
const Exception &e)
1751 catch(
const Exception &e)
1776 catch(
const Exception &e)
1802 catch(
const Exception &e)
1821 catch(
const Exception &e)
1836 ShowMessage(
"No preferred direction selection");
1840 Screen->Cursor = TCursor(-11);
1845 Screen->Cursor = TCursor(-2);
1848 catch(
const Exception &e)
1861 TMsgDlgButtons Buttons;
1862 Buttons << mbYes << mbNo;
1863 if(MessageDlg(
"Do you really want to clear all preferred directions?", mtWarning, Buttons, 0) == mrNo)
1879 catch(
const Exception &e)
1894 Screen->Cursor = TCursor(-11);
1903 Screen->Cursor = TCursor(-2);
1906 catch(
const Exception &e)
1924 catch(
const Exception &e)
1945 catch(
const Exception &e)
1970 catch(
const Exception &e)
1994 InfoPanel->Caption =
"PRE-START: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
1996 InfoPanel->Caption =
"OPERATING: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
2004 catch(
const Exception &e)
2028 InfoPanel->Caption =
"PRE-START: Select PREFERRED ROUTE start signal, or left click points to change manually";
2030 InfoPanel->Caption =
"OPERATING: Select PREFERRED ROUTE start signal, or left click points to change manually";
2038 catch(
const Exception &e)
2068 InfoPanel->Caption =
"PRE-START: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
2070 InfoPanel->Caption =
"OPERATING: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
2078 catch(
const Exception &e)
2093 InfoPanel->Caption =
"ROUTE CANCELLING: Right click on truncate element, first element to cancel (anywhere else to skip)";
2100 catch(
const Exception &e)
2127 catch(
const Exception &e)
2141 UnicodeString MessageStr =
"Please note that the session will be lost if it hasn't been saved. Do you still wish to exit?";
2144 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
2181 catch(
const Exception &e)
2218 catch(
const Exception &e)
2230 Screen->Cursor = TCursor(-11);
2231 std::ifstream VecFile(LoadFileName.c_str());
2232 if(!(VecFile.fail()))
2237 bool GraphicsFollow =
false;
2256 TFont *TempFont =
new TFont;
2257 TempFont->Style.Clear();
2258 TempFont->Name =
"MS Sans Serif";
2259 TempFont->Size = 10;
2261 TempFont->Charset = (TFontCharset)(0);
2270 if((LeftExcess > 0) && (RightExcess > 0))
2272 else if((LeftExcess > 0) && (RightExcess <= 0))
2275 else if((LeftExcess <= 0) && (RightExcess > 0))
2283 if((TopExcess > 0) && (BotExcess > 0))
2285 else if((TopExcess > 0) && (BotExcess <= 0))
2288 else if((TopExcess <= 0) && (BotExcess > 0))
2300 if((LastChar ==
'y') || (LastChar ==
'Y'))
2304 ShowMessage(
"Railway not ready for operation so unable to load as a .rly file. Loading as a new railway under development");
2311 Screen->Cursor = TCursor(-2);
2344 ShowMessage(
"File open failed prior to load");
2345 Screen->Cursor = TCursor(-2);
2348 ShowMessage(
"File integrity check failed - unable to load");
2363 Screen->Cursor = TCursor(-11);
2365 if(!(VecFile.fail()))
2392 ShowMessage(
"File open failed prior to save");
2393 Screen->Cursor = TCursor(-2);
2398 catch(
const Exception &e)
2414 catch(
const Exception &e)
2430 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2434 Screen->Cursor = TCursor(-11);
2437 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2441 AnsiString ShortName =
"";
2442 for(
int x = ImageFileName.Length(); x > 0; x--)
2444 if(ImageFileName[x] ==
'\\')
2446 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2450 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2451 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2452 RailwayImage->PixelFormat = pf8bit;
2458 RailwayImage->Width = HPosMax - HPosMin;
2459 RailwayImage->Height = VPosMax - VPosMin;
2467 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2468 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2469 if(NewWidth > RailwayImage->Width)
2471 RailwayImage->Width = NewWidth;
2473 if(NewHeight > RailwayImage->Height)
2475 RailwayImage->Height = NewHeight;
2480 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2481 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2482 RailwayImage->Canvas->FillRect(Rect);
2490 RailwayImage->SaveToFile(ImageFileName);
2491 delete RailwayImage;
2494 Screen->Cursor = TCursor(-2);
2497 catch(
const Exception &e)
2499 if(e.Message.Pos(
"torage") > 0)
2501 Screen->Cursor = TCursor(-2);
2502 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2503 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
2522 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2526 Screen->Cursor = TCursor(-11);
2529 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2533 AnsiString ShortName =
"";
2534 for(
int x = ImageFileName.Length(); x > 0; x--)
2536 if(ImageFileName[x] ==
'\\')
2538 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2542 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2543 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2544 RailwayImage->PixelFormat = pf8bit;
2549 RailwayImage->Width = HPosMax - HPosMin;
2550 RailwayImage->Height = VPosMax - VPosMin;
2558 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2559 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2560 if(NewWidth > RailwayImage->Width)
2562 RailwayImage->Width = NewWidth;
2564 if(NewHeight > RailwayImage->Height)
2566 RailwayImage->Height = NewHeight;
2571 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2572 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2573 RailwayImage->Canvas->FillRect(Rect);
2576 for(
int x = 0; x < ((RailwayImage->Width) / 16); x++)
2578 for(
int y = 0; y < ((RailwayImage->Height) / 16); y++)
2588 RailwayImage->SaveToFile(ImageFileName);
2589 delete RailwayImage;
2592 Screen->Cursor = TCursor(-2);
2595 catch(
const Exception &e)
2597 if(e.Message.Pos(
"torage") > 0)
2599 Screen->Cursor = TCursor(-2);
2600 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2601 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
2619 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2623 Screen->Cursor = TCursor(-11);
2626 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2630 AnsiString ShortName =
"";
2631 for(
int x = ImageFileName.Length(); x > 0; x--)
2633 if(ImageFileName[x] ==
'\\')
2635 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2639 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2640 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2641 RailwayImage->PixelFormat = pf8bit;
2646 RailwayImage->Width = HPosMax - HPosMin;
2647 RailwayImage->Height = VPosMax - VPosMin;
2655 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2656 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2657 if(NewWidth > RailwayImage->Width)
2659 RailwayImage->Width = NewWidth;
2661 if(NewHeight > RailwayImage->Height)
2663 RailwayImage->Height = NewHeight;
2668 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2669 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2670 RailwayImage->Canvas->FillRect(Rect);
2678 RailwayImage->SaveToFile(ImageFileName);
2679 delete RailwayImage;
2682 Screen->Cursor = TCursor(-2);
2685 catch(
const Exception &e)
2687 if(e.Message.Pos(
"torage") > 0)
2689 Screen->Cursor = TCursor(-2);
2690 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2691 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
2709 ShowMessage(
"Failed to find folder " +
IMAGE_DIR_NAME +
" in the folder where 'railway.exe' resides. Image can't be saved");
2713 Screen->Cursor = TCursor(-11);
2718 TimetableTimeStr = TimetableTimeStr.SubString(1, 2) +
'.' + TimetableTimeStr.SubString(4, 2) +
'.' + TimetableTimeStr.SubString(7, 2);
2719 AnsiString ImageFileName = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
2724 AnsiString ShortName =
"";
2725 for(
int x = ImageFileName.Length(); x > 0; x--)
2727 if(ImageFileName[x] ==
'\\')
2729 ShortName = ImageFileName.SubString(x + 1, ImageFileName.Length() - x - 4);
2733 ShowMessage(
"A bitmap file named " + ShortName +
" will be created in the Images folder");
2734 Graphics::TBitmap *RailwayImage =
new Graphics::TBitmap;
2735 RailwayImage->PixelFormat = pf8bit;
2740 RailwayImage->Width = HPosMax - HPosMin;
2741 RailwayImage->Height = VPosMax - VPosMin;
2749 int NewWidth = (TextPtr->HPos - HPosMin) + (abs(TextPtr->Font->Height) * TextPtr->TextString.Length() * 0.7);
2750 int NewHeight = (TextPtr->VPos - VPosMin) + (abs(TextPtr->Font->Height) * 1.5);
2751 if(NewWidth > RailwayImage->Width)
2753 RailwayImage->Width = NewWidth;
2755 if(NewHeight > RailwayImage->Height)
2757 RailwayImage->Height = NewHeight;
2762 RailwayImage->Canvas->Brush->Color =
clB5G5R5;
2763 TRect Rect(0, 0, RailwayImage->Width, RailwayImage->Height);
2764 RailwayImage->Canvas->FillRect(Rect);
2779 bool BreakFlag =
false;
2805 RailwayImage->SaveToFile(ImageFileName);
2806 delete RailwayImage;
2809 Screen->Cursor = TCursor(-2);
2812 catch(
const Exception &e)
2814 if(e.Message.Pos(
"torage") > 0)
2816 Screen->Cursor = TCursor(-2);
2817 UnicodeString MessageStr =
"Insufficient memory available to store this image";
2818 Application->MessageBox(MessageStr.c_str(), L
"", MB_OK | MB_ICONWARNING);
2846 Screen->Cursor = TCursor(-11);
2848 if(!(VecFile.fail()))
2875 ShowMessage(
"Railway failed to save - can't open file");
2876 Screen->Cursor = TCursor(-2);
2880 catch(
const Exception &e)
2894 catch(
const Exception &e)
2914 catch(
const Exception &e)
2929 ShowMessage(
"Failed to find folder " +
FORMATTEDTT_DIR_NAME +
" in the folder where 'railway.exe' resides. Timetable can't be exported");
2933 Screen->Cursor = TCursor(-11);
2936 Screen->Cursor = TCursor(-2);
2939 catch(
const Exception &e)
2998 AZOrderButton->Hint = AnsiString(
"Arrange services in alphabetical order Toggle with Shift+ Z");
3015 ActiveTrackElementNameMapEntry.first =
Track->
TrackVector.at(x).ActiveTrackElementName;
3016 ActiveTrackElementNameMapEntry.second = 0;
3066 catch(
const Exception &e)
3108 if(TTBLFile.is_open())
3112 while(!TTBLFile.eof())
3115 if((c < 32) && (c != 13) && (c != 10) && (c !=
'\0'))
3117 ShowMessage(
"Timetable file is empty or contains non-ascii characters, codes must be between 20 and 127, or CR or LF");
3127 ShowMessage(
"Failed to open timetable file, make sure it's not open in another application");
3134 if(TTBLFile.is_open())
3143 AZOrderButton->Hint = AnsiString(
"Arrange services in alphabetical order Toggle with Shift+ Z");
3156 char *TimetableEntryString =
new char[10000];
3159 TTBLFile.getline(TimetableEntryString, 10000,
'\0');
3160 if(TTBLFile.eof() && (TimetableEntryString[0] ==
'\0'))
3165 AnsiString OneLine(TimetableEntryString);
3169 delete TimetableEntryString;
3174 ShowMessage(
"Failed to open timetable file, make sure it's not open in another application");
3210 ActiveTrackElementNameMapEntry.first =
Track->
TrackVector.at(x).ActiveTrackElementName;
3211 ActiveTrackElementNameMapEntry.second = 0;
3236 catch(
const Exception &e)
3254 InfoPanel->Caption =
"Timetable mode: editor hidden";
3260 ShowHideTTButton->Hint =
"Hide the timetable editor to see the railway Shift H";
3265 catch(
const Exception &e)
3304 catch(
const Exception &e)
3343 catch(
const Exception &e)
3363 catch(
const Exception &e)
3376 bool ValidFlag =
true;
3395 TDateTime DummyTime;
3413 ShowMessage(
"One or more times excessive, not permitted to exceed 95 hours");
3417 AnsiString MinsStr = AnsiString(Mins), HrsStr = AnsiString(Hrs);
3419 MinsStr =
"0" + MinsStr;
3421 HrsStr =
"0" + HrsStr;
3424 NewString += HrsStr +
':' + MinsStr;
3441 catch(
const Exception &e)
3454 bool ValidFlag =
true;
3473 TDateTime DummyTime;
3491 ShowMessage(
"One or more times are now before 00:00, this is not permitted");
3495 AnsiString MinsStr = AnsiString(Mins), HrsStr = AnsiString(Hrs);
3497 MinsStr =
"0" + MinsStr;
3499 HrsStr =
"0" + HrsStr;
3502 NewString += HrsStr +
':' + MinsStr;
3518 catch(
const Exception &e)
3556 catch(
const Exception &e)
3630 catch(
const Exception &e)
3689 catch(
const Exception &e)
3707 UnicodeString MessageStr =
"Are you sure this entry should be deleted?";
3708 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
3768 catch(
const Exception &e)
3789 AnsiString TempStr =
"";
3790 bool ActiveLine =
false;
3815 while(TempStr[TempStr.Length()] ==
',')
3817 TempStr = TempStr.SubString(1, TempStr.Length() - 1);
3846 (*TTCurrentEntryPtr) = TempStr;
3916 catch(
const Exception &e)
3931 ShowMessage(
"Timetable is empty, can't save an empty timetable");
3935 std::ofstream TTBLFile;
3958 if(TTBLFile.is_open())
3962 TTBLFile << (*TEVPtr).c_str() <<
'\0';
3969 ShowMessage(
CreateEditTTFileName +
" failed to open, ensure not already open in another application");
3975 catch(
const Exception &e)
3990 ShowMessage(
"Timetable is empty, can't save an empty timetable");
3994 std::ofstream TTBLFile;
3998 for(
int x =
SaveTTDialog->FileName.Length(); x > 0; x--)
4009 if(TTBLFile.is_open())
4013 TTBLFile << (*TEVPtr).c_str() <<
'\0';
4020 ShowMessage(
CreateEditTTFileName +
" failed to open, ensure not already open in another application");
4026 catch(
const Exception &e)
4040 bool EndOfFile =
false;
4041 bool FinalCallFalse =
false;
4042 bool GiveMessagesTrue =
true;
4043 bool CheckLocationsExistInRailway =
false;
4045 CheckLocationsExistInRailway =
true;
4051 "The basic syntax seems OK but this check is very limited. Other aspects can only be checked by validating the whole timetable with the appropriate railway (.rly) loaded");
4057 catch(
const Exception &e)
4085 bool CheckLocationsExistInRailwayTrue =
true;
4088 Screen->Cursor = TCursor(-11);
4090 if(TTBLFile.is_open())
4094 ShowMessage(
"Timetable integrity OK");
4101 ShowMessage(
"Failed to open timetable file, make sure it's not open in another application");
4103 Screen->Cursor = TCursor(-2);
4113 catch(
const Exception &e)
4137 AnsiString TempStr = *
TEVPtr;
4175 catch(
const Exception &e)
4199 AnsiString TempStr = *
TEVPtr;
4237 catch(
const Exception &e)
4274 catch(
const Exception &e)
4289 UnicodeString MessageStr =
"All changes to the timetable will be lost - proceed?";
4290 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
4301 if(TTBLFile.is_open())
4318 char *TimetableEntryString =
new char[10000];
4321 TTBLFile.getline(TimetableEntryString, 10000,
'\0');
4322 if(TTBLFile.eof() && (TimetableEntryString[0] ==
'\0'))
4327 AnsiString OneLine(TimetableEntryString);
4331 delete TimetableEntryString;
4336 ShowMessage(
"Failed to open timetable file, make sure it's not open in another application");
4357 catch(
const Exception &e)
4372 ShowMessage(
"Failed to find folder " +
FORMATTEDTT_DIR_NAME +
" in the folder where 'railway.exe' resides. Timetable can't be exported");
4376 Screen->Cursor = TCursor(-11);
4390 Screen->Cursor = TCursor(-2);
4395 catch(
const Exception &e)
4428 catch(
const Exception &e)
4443 UnicodeString MessageStr =
"The timetable has changed.\n\nAre you sure you want to exit without saving it?";
4444 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
4459 catch(
const Exception &e)
4487 catch(
const Exception &e)
4512 catch(
const Exception &e)
4530 catch(
const Exception &e)
4553 catch(
const Exception &e)
4604 catch(
const Exception &e)
4632 if((TopPos + (Y / 13)) >=
OAListBox->Items->Count)
4640 std::advance(OACurrentEntryPtr, ((Y / 13) + TopPos));
4644 int TrackVectorPosition;
4645 int TrainIDorTVPos = OACurrentEntryPtr->second.second;
4646 if(TrainIDorTVPos >= 0)
4662 TrackVectorPosition = -(TrainIDorTVPos + 1);
4677 TPoint MainScreenPoint(ScreenPosH + 8, ScreenPosV + 8);
4678 TPoint CursPos =
MainScreen->ClientToScreen(MainScreenPoint);
4679 Mouse->CursorPos = CursPos;
4682 catch(
const Exception &e)
4694 PreStartTime, ActiveSegment, PostEnd} Segment;
4707 Segment = PreStartTime;
4710 if(Segment == PreStartTime)
4717 Segment = ActiveSegment;
4728 AnsiString CurrentStr = *
TEVPtr;
4729 if(CurrentStr !=
"")
4731 CurrentStr = CurrentStr.SubString(1, 10);
4732 for(
int x = 1; x < CurrentStr.Length(); x++)
4734 if((CurrentStr[x] < 32) || (CurrentStr[1] > 126))
4736 CurrentStr = CurrentStr.SubString(1, (x - 1));
4745 if(Segment == ActiveSegment)
4760 AnsiString Entry = *
TEVPtr;
4765 int SCPos = Entry.Pos(
';');
4766 int CPos = Entry.Pos(
',');
4773 if((CPos == 0) && (SCPos == 0))
4775 Entry = Entry.SubString(1, 12);
4777 else if((CPos > 0) && (SCPos > 0) && (CPos < SCPos))
4779 Entry = Entry.SubString(1, CPos - 1);
4781 else if((CPos > 0) && (SCPos > 0) && (CPos > SCPos))
4783 Entry = Entry.SubString(1, SCPos - 1);
4785 else if((CPos > 0) && (SCPos == 0))
4787 Entry = Entry.SubString(1, CPos - 1);
4791 Entry = Entry.SubString(1, SCPos - 1);
4804 if(Segment == PostEnd)
4812 AnsiString CurrentStr = *
TEVPtr;
4813 if(CurrentStr !=
"")
4815 CurrentStr = CurrentStr.SubString(1, 10);
4816 for(
int x = 1; x < CurrentStr.Length(); x++)
4818 if((CurrentStr[x] < 32) || (CurrentStr[1] > 126))
4820 CurrentStr = CurrentStr.SubString(1, (x - 1));
4851 UnicodeString MessageStr =
4852 "If you wish to preserve the original order don't make any changes whilst in alphabetical order.\n\nIn that case use alphabetical order to find the service required, click it to display it, then revert to the original order where the same service will be displayed and can be changed.";
4853 Application->MessageBox(MessageStr.c_str(), L
"Please Note:", MB_OK | MB_ICONWARNING);
4866 std::sort(SortStart, SortEnd);
4868 bool CurrentEntryChanged =
false;
4874 CurrentEntryChanged =
true;
4877 if(!CurrentEntryChanged)
4882 AZOrderButton->Hint = AnsiString(
"Arrange services in original order Toggle with Shift+ Z");
4888 UnicodeString MessageStr =
4889 "Reverting to the original order will discard any changes made whilst in alphabetical order.\n\nTo preserve the changes click 'No', then save the timetable or use 'save as' if you wish to keep the original timetable.\n\nDo you wish to proceed?";
4890 int button = Application->MessageBox(MessageStr.c_str(), L
"Warning!", MB_YESNO | MB_ICONWARNING);
4904 bool CurrentEntryChanged =
false;
4910 CurrentEntryChanged =
true;
4913 if(!CurrentEntryChanged)
4918 AZOrderButton->Hint = AnsiString(
"Arrange services in alphabetical order Toggle with Shift+ Z");
4927 catch(
const Exception &e)
4938 AnsiString OutStr =
"";
4941 while(x < ConvStr.Length())
4943 if((ConvStr[x] ==
'\r') && (ConvStr[x + 1] ==
'\n'))
4951 OutStr += ConvStr[x];
4955 if(x == ConvStr.Length())
4956 OutStr += ConvStr[x];
4961 while(OutStr[OutStr.Length()] ==
',')
4963 OutStr = OutStr.SubString(1, OutStr.Length() - 1);
5032 InfoPanel->Caption =
"Select option or change entry";
5046 bool ValidFlag =
true;
5047 for(
int x = 1; x <= AnsiAddSubText.Length(); x++)
5049 if((AnsiAddSubText[x] >
'9') || (AnsiAddSubText[x] <
'0'))
5057 if(AnsiAddSubText.ToInt() != 0)
5128 bool ServiceEntry =
true;
5133 bool ServiceEntry =
false;
5145 InfoPanel->Caption =
"Add or change entry then save it, or cancel";
5155 AnsiString((
short)ServiceEntry));
5162 int CommaPos = Data.Pos(
',');
5163 if((CommaPos == 0) && (Data !=
""))
5165 CommaPos = Data.Length() + 1;
5168 if(Data.Length() <= CommaPos)
5170 Data = Data.SubString(CommaPos + 1, Data.Length() - CommaPos);
5207 if(CurrentStr !=
"")
5209 for(
int x = 1; x < CurrentStr.Length(); x++)
5211 if((CurrentStr[x] < 32) || (CurrentStr[1] > 126))
5213 CurrentStr = CurrentStr.SubString(1, (x - 1));
5238 TDateTime DummyTime;
5239 bool TimesPresent =
false;
5247 TimesPresent =
true;
5254 return TimesPresent;
5268 UnicodeString MessageStr =
5269 "Note that leaving the track unlinked will cause preferred directions to be lost on reloading. Prevent by linking the track then resaving. Do you still wish to exit?";
5270 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
5279 UnicodeString MessageStr =
"The railway has changed, exit without saving?";
5280 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
5292 Application->Terminate();
5294 catch(
const Exception &e)
5317 catch(
const Exception &e)
5340 catch(
const Exception &e)
5363 catch(
const Exception &e)
5422 catch(
const Exception &e)
5440 catch(
const Exception &e)
5459 catch(
const Exception &e)
5494 catch(
const Exception &e)
5505 TrainController->
LogEvent(
"MainScreenMouseDown2," + AnsiString(Button) +
"," + AnsiString(X) +
"," + AnsiString(Y));
5507 "," + AnsiString(Y));
5518 int NoOffsetX, NoOffsetY;
5520 if(Button == mbRight)
5530 Screen->Cursor = TCursor(-22);
5581 bool TrackEraseSuccessfulFlag;
5582 int ErasedTrackVectorPosition;
5583 Screen->Cursor = TCursor(-11);
5585 if(TrackEraseSuccessfulFlag)
5587 if(ErasedTrackVectorPosition > -1)
5618 Screen->Cursor = TCursor(-2);
5626 bool LeadingPointsAtLastElement =
false;
5641 if(!LeadingPointsAtLastElement)
5646 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Continue or set values (overall length), or right click to cancel/truncate";
5661 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Can't end on leading points, continue or truncate";
5738 if((TrainID01 > -1) && (TrainID23 > -1))
5788 AnsiString LocName =
"";
5793 if((LocName ==
"") && (Train.
MidElement > -1))
5907 Screen->Cursor = TCursor(-11);
5918 Screen->Cursor = TCursor(-2);
5985 Screen->Cursor = TCursor(-11);
5987 bool TrackLinkingRequiredFlag;
5989 TSpeedButton *TempSpeedButton = 0;
5997 bool InternalChecks =
true;
6003 if(TrackLinkingRequiredFlag)
6032 Screen->Cursor = TCursor(-2);
6046 NewGI.
Width = UGMIt->second->Width;
6047 NewGI.
Height = UGMIt->second->Height;
6072 AnsiString NameString;
6082 unsigned int ValidPosition;
6093 ValidElement = InactiveTrackElement1;
6094 ValidPosition = InactivePair.first;
6099 ValidElement = InactiveTrackElement2;
6100 ValidPosition = InactivePair.second;
6111 InfoPanel->Caption =
"NAMING LOCATIONS: Enter name, 'Carriage Return' to accept, 'Escape' to quit";
6142 bool FinishElement =
false, LeadingPointsAtLastElement =
false;
6143 Screen->Cursor = TCursor(-11);
6157 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Set values (overall length), or right click to cancel/truncate";
6167 Screen->Cursor = TCursor(-2);
6173 if(!LeadingPointsAtLastElement)
6178 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Continue or set values (overall length), or right click to cancel/truncate";
6195 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Can't end on leading points, need to continue or truncate";
6210 Screen->Cursor = TCursor(-2);
6215 Screen->Cursor = TCursor(-2);
6232 InfoPanel->Caption =
"CONNECTING GAPS: Connecting element selected";
6244 ShowMessage(
"All gaps set");
6272 int TrueX = 0, TrueY = 0;
6273 AnsiString ExistingText =
"";
6275 TFont *ExistingTextFont =
new TFont;
6276 int ExistingTextHPos = 0, ExistingTextVPos = 0;
6282 if((TrueX >= (*TextPtr).HPos) && (TrueX < ((*TextPtr).HPos + abs((*TextPtr).Font->Height))) && (TrueY >= (*TextPtr).VPos) && (TrueY <
6283 ((*TextPtr).VPos + abs((*TextPtr).Font->Height))))
6285 ExistingText = (*TextPtr).TextString;
6286 ExistingTextFont->Assign((*TextPtr).Font);
6287 ExistingTextHPos = (*TextPtr).HPos;
6288 ExistingTextVPos = (*TextPtr).VPos;
6300 TextBox->Font->Assign(ExistingTextFont);
6302 Text_X = ExistingTextHPos;
6303 Text_Y = ExistingTextVPos;
6318 TextBox->Text =
"New Text: CR=end, ESC=quit";
6321 delete ExistingTextFont;
6413 Screen->Cursor = TCursor(-11);
6422 ShowMessage(
"Preferred direction added");
6426 Screen->Cursor = TCursor(-2);
6445 Screen->Cursor = TCursor(-2);
6449 Screen->Cursor = TCursor(-2);
6546 AnsiString(PDE.
VLoc));
6559 bool PointsChanged =
false;
6560 IDInt ReqPosRouteID(-1);
6562 bool CallonTrue =
true;
6563 bool ConsecSignalsRouteFalse =
false;
6572 CallonTrue, ReqPosRouteID, PointsChanged))
6614 float TempSpeedVal = 1;
6682 int DivergingPosition = TrackElement.
Conn[3];
6684 DivergingPosition)))
6759 InfoPanel->Caption =
"PRE-START: Select next route location";
6761 InfoPanel->Caption =
"OPERATING: Select next route location";
6773 bool CallonFalse =
false;
6780 InfoPanel->Caption =
"PRE-START: Select next route location";
6782 InfoPanel->Caption =
"OPERATING: Select next route location";
6800 Screen->Cursor = TCursor(-11);
6802 bool PointsChanged =
false;
6812 float TempSpeedVal = 1;
6817 else if(PointsChanged)
6828 Screen->Cursor = TCursor(-2);
6836 bool CallonFalse =
false;
6842 float TempSpeedVal = 1;
6847 else if(PointsChanged)
6861 Screen->Cursor = TCursor(-2);
6870 catch(
const Exception &e)
6884 TrainController->
LogEvent(
"MainScreenMouseDown3," + AnsiString(Button) +
"," + AnsiString(X) +
"," + AnsiString(Y));
6886 "," + AnsiString(Y));
6887 if(Button != mbLeft)
6893 Screen->Cursor = TCursor(-22);
6899 int HRounding, VRounding;
6950 else if(TempLevel2OperMode ==
Operating)
6953 OperateButton->Glyph->LoadFromResourceName(0,
"PauseGraphic");
6957 else if(TempLevel2OperMode ==
Paused)
6960 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
6966 else if(TempLevel2OperMode ==
PreStart)
6969 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
6980 catch(
const Exception &e)
7070 if(CurrentHLoc >= StartHLoc)
7074 if(CurrentVLoc >= StartVLoc)
7086 TRect TempRect(StartHLoc, StartVLoc, CurrentHLoc, CurrentVLoc);
7100 if(CurrentHLoc >= StartHLoc)
7104 if(CurrentVLoc >= StartVLoc)
7116 TRect TempRect(StartHLoc, StartVLoc, CurrentHLoc, CurrentVLoc);
7175 catch(
const Exception &e)
7211 TrainController->
LogEvent(
"MainScreenMouseUp," + AnsiString(Button) +
"," + AnsiString(X) +
"," + AnsiString(Y));
7214 Screen->Cursor = TCursor(-2);
7218 Screen->Cursor = TCursor(-11);
7223 if(EndHLoc >= StartHLoc)
7227 if(EndVLoc >= StartVLoc)
7231 if(StartHLoc >= EndHLoc)
7241 if(StartVLoc >= EndVLoc)
7267 Screen->Cursor = TCursor(-2);
7333 if(IATVecPair.second != IATVecPair.first)
7351 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
7359 bool SelectVectorNamedElement =
false;
7360 AnsiString SelectTextString;
7365 SelectVectorNamedElement =
true;
7369 if(SelectVectorNamedElement)
7371 SelectTextString =
"##**" + TextPtr->TextString;
7375 SelectTextString = TextPtr->TextString;
7377 TTextItem TextItem(TextPtr->HPos, TextPtr->VPos, SelectTextString, TextPtr->Font);
7386 for(TTrack::TUserGraphicVector::iterator UserGraphicPtr =
Track->
UserGraphicVector.begin(); UserGraphicPtr < Track->UserGraphicVector.end();
7389 if((UserGraphicPtr->HPos >= LowSelectHPos) && ((UserGraphicPtr->HPos + UserGraphicPtr->Width) < HighSelectHPos) &&
7390 (UserGraphicPtr->VPos >= LowSelectVPos) && ((UserGraphicPtr->VPos + UserGraphicPtr->Height) < HighSelectVPos))
7403 Screen->Cursor = TCursor(-2);
7409 Screen->Cursor = TCursor(-11);
7415 if(EndHLoc >= StartHLoc)
7419 if(EndVLoc >= StartVLoc)
7423 if(StartHLoc >= EndHLoc)
7433 if(StartVLoc >= EndVLoc)
7458 Screen->Cursor = TCursor(-2);
7487 Screen->Cursor = TCursor(-2);
7513 catch(
const Exception &e)
7546 throw Exception(
"Warning - Utilities->CallLog contains more than 50 items");
7573 catch(
const Exception &e)
7653 if(
WholeRailwayMoving && (GetAsyncKeyState(VK_LBUTTON) >= 0) && (GetAsyncKeyState(VK_RBUTTON) >= 0))
7656 Screen->Cursor = TCursor(-2);
7683 bool TrainPresent =
false;
7697 TDateTime TempExcessLCDownTime;
7702 if(TempExcessLCDownTime > TDateTime(0))
7730 bool ElementRemovedFlag =
false;
7741 ElementRemovedFlag =
true;
7753 bool WH1 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog1->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog1->Width +
OutputLog1->Left))
7756 bool WH2 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog2->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog2->Width +
OutputLog2->Left))
7759 bool WH3 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog3->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog3->Width +
OutputLog3->Left))
7762 bool WH4 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog4->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog4->Width +
OutputLog4->Left))
7765 bool WH5 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog5->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog5->Width +
OutputLog5->Left))
7768 bool WH6 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog6->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog6->Width +
OutputLog6->Left))
7771 bool WH7 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog7->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog7->Width +
OutputLog7->Left))
7774 bool WH8 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog8->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog8->Width +
OutputLog8->Left))
7777 bool WH9 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog9->Left) && (Mouse->CursorPos.x < (ClientOrigin.x +
OutputLog9->Width +
OutputLog9->Left))
7780 bool WH10 = (Mouse->CursorPos.x >= ClientOrigin.x +
OutputLog10->Left) &&
7784 if(WH1 || WH2 || WH3 || WH4 || WH5 || WH6 || WH7 || WH8 || WH9 || WH10)
7805 AnsiString Type[15] =
7806 {
"Simple",
"Crossover",
"Points",
"Buffers",
"Bridge",
"SignalPost",
"Continuation",
"Platform",
"GapJump",
"FootCrossing",
"Unused",
"Concourse",
7807 "Parapet",
"NamedNonStationLocation",
"Erase"};
7809 int ScreenX = Mouse->CursorPos.x -
MainScreen->ClientOrigin.x;
7810 int ScreenY = Mouse->CursorPos.y -
MainScreen->ClientOrigin.y;
7812 AnsiString MouseStr =
"Posx: " + AnsiString(ScreenX) +
"; Posy: " + AnsiString(ScreenY);
7817 DevelopmentPanel->Caption = MouseStr +
"; TVPos: " + AnsiString(Position) +
"; H: " + AnsiString(HLoc) +
"; V: " + AnsiString(VLoc) +
7818 "; SpTg: " + AnsiString(TrackElement.
SpeedTag) +
"; Type: " + Type[TrackElement.
TrackType] +
"; Att: " + AnsiString(TrackElement.
Attribute)
7847 Screen->Cursor = TCursor(-11);
7990 int RouteStartVecPos;
8000 if(FoundFlag && (RouteStartVecPos > -1))
8016 catch(
const Exception &e)
8034 InfoPanel->Caption =
"CALLING ON: Select signal for call on";
8048 catch(
const Exception &e)
8062 Screen->Cursor = TCursor(-11);
8104 Screen->Cursor = TCursor(-2);
8107 catch(
const Exception &e)
8121 Screen->Cursor = TCursor(-11);
8163 Screen->Cursor = TCursor(-2);
8166 catch(
const Exception &e)
8180 Screen->Cursor = TCursor(-11);
8223 Screen->Cursor = TCursor(-2);
8226 catch(
const Exception &e)
8240 Screen->Cursor = TCursor(-11);
8282 Screen->Cursor = TCursor(-2);
8285 catch(
const Exception &e)
8299 Screen->Cursor = TCursor(-11);
8336 OperateButton->Glyph->LoadFromResourceName(0,
"PauseGraphic");
8343 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
8352 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
8379 if((LeftExcess > 0) && (RightExcess > 0))
8381 else if((LeftExcess > 0) && (RightExcess <= 0))
8384 else if((LeftExcess <= 0) && (RightExcess > 0))
8392 if((TopExcess > 0) && (BotExcess > 0))
8394 else if((TopExcess > 0) && (BotExcess <= 0))
8397 else if((TopExcess <= 0) && (BotExcess > 0))
8407 ZoomButton->Glyph->LoadFromResourceName(0,
"ZoomIn");
8409 Screen->Cursor = TCursor(-2);
8413 catch(
const Exception &e)
8427 Screen->Cursor = TCursor(-11);
8450 Screen->Cursor = TCursor(-2);
8454 catch(
const Exception &e)
8482 catch(
const Exception &e)
8498 catch(
const Exception &e)
8525 catch(
const Exception &e)
8548 TRect NewSelectRect(TLHCH, TLHCV, BRHCH, BRHCV);
8581 catch(
const Exception &e)
8600 catch(
const Exception &e)
8619 catch(
const Exception &e)
8667 int MidVPosAfterFlip = ((VerSum * 16) + 15) - MidVPosBeforeFlip;
8675 catch(
const Exception &e)
8723 int MidHPosAfterMirror = ((HorSum * 16) + 15) - MidHPosBeforeMirror;
8725 if(LeftPosAfterMirror < (
SelectRect.left * 16))
8735 catch(
const Exception &e)
8788 int MidVPosAfterFlip = ((VerSum * 16) + 15) - MidVPosBeforeFlip;
8800 int MidHPosAfterMirror = ((HorSum * 16) + 15) - MidHPosBeforeMirror;
8802 if(LeftPosAfterMirror < (
SelectRect.left * 16))
8814 catch(
const Exception &e)
8827 Screen->Cursor = TCursor(-11);
8844 int button = Application->MessageBox
8845 (L
"Original selection adjusted to make it square. 'OK' to keep this selection or 'Cancel' to make a new selection",
8846 L
"Left click and hold here to move this message box", MB_OKCANCEL);
8847 if(button == IDCANCEL)
8855 Screen->Cursor = TCursor(-2);
8892 if(IATVecPair.second != IATVecPair.first)
8910 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos < HighSelectVPos))
8917 bool SelectVectorNamedElement =
false;
8918 AnsiString SelectTextString;
8923 SelectVectorNamedElement =
true;
8927 if(SelectVectorNamedElement)
8929 SelectTextString =
"##**" + TextPtr->TextString;
8933 SelectTextString = TextPtr->TextString;
8935 TTextItem TextItem(TextPtr->HPos, TextPtr->VPos, SelectTextString, TextPtr->Font);
8944 for(TTrack::TUserGraphicVector::iterator UserGraphicPtr =
Track->
UserGraphicVector.begin(); UserGraphicPtr < Track->UserGraphicVector.end();
8947 if((UserGraphicPtr->HPos >= LowSelectHPos) && ((UserGraphicPtr->HPos + UserGraphicPtr->Width) < HighSelectHPos) && (UserGraphicPtr->VPos >=
8948 LowSelectVPos) && ((UserGraphicPtr->VPos + UserGraphicPtr->Height) < HighSelectVPos))
8987 int MidHPosAfterRotate = ((
SelectRect.bottom * 16) - 1) + (
SelectRect.left * 16) - MidVPosBeforeRotate;
8994 Screen->Cursor = TCursor(-2);
8999 catch(
const Exception &e)
9013 Screen->Cursor = TCursor(-11);
9030 int button = Application->MessageBox
9031 (L
"Original selection adjusted to make it square. 'OK' to keep this selection or 'Cancel' to make a new selection",
9032 L
"Left click and hold here to move this message box", MB_OKCANCEL);
9033 if(button == IDCANCEL)
9041 Screen->Cursor = TCursor(-2);
9078 if(IATVecPair.second != IATVecPair.first)
9096 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos < HighSelectVPos))
9103 bool SelectVectorNamedElement =
false;
9104 AnsiString SelectTextString;
9109 SelectVectorNamedElement =
true;
9113 if(SelectVectorNamedElement)
9115 SelectTextString =
"##**" + TextPtr->TextString;
9119 SelectTextString = TextPtr->TextString;
9121 TTextItem TextItem(TextPtr->HPos, TextPtr->VPos, SelectTextString, TextPtr->Font);
9130 for(TTrack::TUserGraphicVector::iterator UserGraphicPtr =
Track->
UserGraphicVector.begin(); UserGraphicPtr < Track->UserGraphicVector.end();
9133 if((UserGraphicPtr->HPos >= LowSelectHPos) && ((UserGraphicPtr->HPos + UserGraphicPtr->Width) < HighSelectHPos) && (UserGraphicPtr->VPos >=
9134 LowSelectVPos) && ((UserGraphicPtr->VPos + UserGraphicPtr->Height) < HighSelectVPos))
9174 int MidVPosAfterRotate = ((
SelectRect.bottom * 16) - 1) + (
SelectRect.left * 16) - MidHPosBeforeRotate;
9180 Screen->Cursor = TCursor(-2);
9185 catch(
const Exception &e)
9205 catch(
const Exception &e)
9224 catch(
const Exception &e)
9242 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Set values or leave blank for no change";
9243 ShowMessage(
"Note: length value will apply to each element's track within the selection");
9251 catch(
const Exception &e)
9269 bool FoundFlag =
false;
9313 catch(
const Exception &e)
9343 catch(
const Exception &e)
9370 bool CheckLocationsExistInRailwayTrue =
true;
9374 Screen->Cursor = TCursor(-11);
9375 std::ifstream TTBLFile(AnsiString(
TimetableDialog->FileName).c_str(), std::ios_base::binary);
9376 if(TTBLFile.is_open())
9378 bool SessionFileFalse =
false;
9386 ShowMessage(
"Failed to open timetable file, make sure it's not open in another application");
9388 Screen->Cursor = TCursor(-2);
9391 ShowMessage(
"Timetable preliminary integrity check failed - unable to load");
9396 catch(
const Exception &e)
9421 AnsiString LocName =
"";
9426 if((LocName ==
"") && (Train.
MidElement > -1))
9446 if((NextElementPosition > -1) && (NextEntryPos > -1))
9461 if((LocName ==
"") && (Train.
MidElement > -1))
9468 catch(
const Exception &e)
9492 AnsiString LocName =
"";
9497 if((LocName ==
"") && (Train.
MidElement > -1))
9505 if((LocName ==
"") && (Train.
MidElement > -1))
9535 int NextElementPos = -1;
9536 int NextEntryPos = -1;
9552 if((NextElementPos > -1) && (NextEntryPos > -1))
9586 catch(
const Exception &e)
9604 AnsiString LocName =
"";
9609 if((LocName ==
"") && (Train.
MidElement > -1))
9617 if((LocName ==
"") && (Train.
MidElement > -1))
9624 catch(
const Exception &e)
9653 int NextElementPos = -1;
9654 int NextEntryPos = -1;
9660 if((NextElementPos > -1) && (NextEntryPos > -1))
9680 catch(
const Exception &e)
9693 TTrain *TrainToBeJoinedBy;
9706 ShowMessage(
"Can't join two trains when both are without power");
9710 AnsiString TrainToBeJoinedByHeadCode = TrainToBeJoinedBy->
HeadCode;
9712 double OtherBrakeForce = TrainToBeJoinedBy->
MaxBrakeRate * TrainToBeJoinedBy->
Mass;
9714 double CombinedBrakeRate = (OtherBrakeForce + OwnBrakeForce) / (TrainToBeJoinedBy->
Mass + ThisTrain.
Mass);
9715 ThisTrain.
Mass += TrainToBeJoinedBy->
Mass;
9722 AnsiString LocName =
"";
9727 if((LocName ==
"") && (ThisTrain.
MidElement > -1))
9735 if((LocName ==
"") && (ThisTrain.
MidElement > -1))
9769 catch(
const Exception &e)
9799 AnsiString LocName =
"";
9804 if((LocName ==
"") && (Train.
MidElement > -1))
9812 if((LocName ==
"") && (Train.
MidElement > -1))
9828 catch(
const Exception &e)
9859 catch(
const Exception &e)
9875 if(NextElementPos < 0)
9877 throw Exception(
"Error, no element in front in PassRedSignalMenuItemClick");
9888 throw Exception(
"Error, next element not a signal type in PassRedSignalMenuItemClick");
9902 catch(
const Exception &e)
9928 int NextElementPos = -1;
9930 int NextEntryPos = -1;
9936 if((NextElementPos > -1) && (NextEntryPos > -1))
9945 catch(
const Exception &e)
9964 UnicodeString Message = UnicodeString(Train.
HeadCode) +
" will be removed from the railway - proceed?";
9965 int button = Application->MessageBox(Message.c_str(), L
"Please confirm", MB_YESNO);
9978 AnsiString LocName =
"";
9983 if((LocName ==
"") && (Train.
MidElement > -1))
9991 if((LocName ==
"") && (Train.
MidElement > -1))
10089 catch(
const Exception &e)
10103 Application->Terminate();
10117 catch(
const Exception &e)
10131 UnicodeString MessageStr =
10132 "Note that leaving the track unlinked will cause preferred directions to be lost on reloading. Prevent by linking the track then resaving. Do you still wish to exit?";
10133 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
10143 UnicodeString MessStr =
"";
10146 MessStr = UnicodeString(
"The railway and the timetable have both changed, exit without saving either?");
10150 MessStr = UnicodeString(
"The railway has changed, exit without saving?");
10154 MessStr = UnicodeString(
"The timetable has changed, exit without saving?");
10156 int button = Application->MessageBox(MessStr.c_str(), L
"Please confirm", MB_YESNO);
10167 UnicodeString MessageStr =
"Please note that the session will be lost if it hasn't been saved. Do you still wish to exit?";
10170 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
10188 catch(
const Exception &e)
10202 if((Shift.Contains(ssAlt)) && (Shift.Contains(ssCtrl)))
10215 else if(Key ==
'3')
10227 else if(Key ==
'4')
10232 else if(Shift.Contains(ssCtrl) && !Shift.Contains(ssShift) && !Shift.Contains(ssAlt))
10236 else if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl) && !Shift.Contains(ssAlt))
10249 if((Key != VK_SHIFT) && (Key != VK_CONTROL))
10266 else if(Key == VK_DOWN)
10271 else if(Key == VK_LEFT)
10276 else if(Key == VK_RIGHT)
10281 else if(Key == VK_HOME)
10287 else if(Key == VK_END)
10292 else if(Key == VK_END)
10306 if(Shift.Contains(ssShift) && !Shift.Contains(ssAlt) && !Shift.Contains(ssCtrl) &&
NewHomeButton->Enabled &&
NewHomeButton->Visible)
10317 if(!Shift.Contains(ssCtrl))
10376 if(Key ==
'S' || Key ==
's')
10387 if(Shift.Contains(ssShift))
10403 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl) && !Shift.Contains(ssAlt))
10450 if(Shift.Contains(ssCtrl) && !Shift.Contains(ssShift) && !Shift.Contains(ssAlt))
10455 if(Key ==
'S' || Key ==
's')
10461 if(!Shift.Contains(ssCtrl) && !Shift.Contains(ssShift) && !Shift.Contains(ssAlt))
10473 if(!Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
10480 if(!Shift.Contains(ssShift) && Shift.Contains(ssCtrl))
10485 if(Key ==
'S' || Key ==
's')
10491 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
10512 if(!Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
10519 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
10525 if(Key ==
'S' || Key ==
's')
10530 else if(Key ==
'H' || Key ==
'h')
10541 if(Shift.Contains(ssShift) && !Shift.Contains(ssCtrl))
10608 if(
SaveTTButton->Enabled && (Key ==
'T' || Key ==
't'))
10629 if(
FloatingInfoMenu->Enabled && !Shift.Contains(ssAlt) && Shift.Contains(ssCtrl) && Shift.Contains(ssShift))
10631 if(Key ==
'I' || Key ==
'i')
10637 if(Key ==
'S' || Key ==
's')
10641 else if(Key ==
'T' || Key ==
't')
10651 catch(
const Exception &e)
10661 if((Key != VK_SHIFT) && (Key != VK_CONTROL))
10781 catch(
const Exception &e)
10794 Application->HelpKeyword(u
"Introduction");
10796 catch(
const Exception &e)
10806 const UnicodeString Link =
"http://www.railwayoperationsimulator.com";
10807 ::ShellExecute(Handle, NULL, (Link).c_str(), NULL, NULL, SW_SHOWNORMAL);
10818 std::ofstream ColFile((
CurDir +
"\\Background.col").c_str());
10842 catch(
const Exception &e)
10856 std::ofstream ColFile((
CurDir +
"\\Background.col").c_str());
10859 ShowMessage(
"Failed to store colour file, program will default to a black background when next loaded");
10879 catch(
const Exception &e)
10893 std::ofstream ColFile((
CurDir +
"\\Background.col").c_str());
10896 ShowMessage(
"Failed to store colour file, program will default to a black background when next loaded");
10916 catch(
const Exception &e)
10972 bool ErrorFlag =
false, TooBigFlag =
false;
10993 if(!ErrorFlag && !TooBigFlag)
11003 int KPH = (MPH * 1.609344) + 0.5;
11010 int MPH = (KPH * 0.621371) + 0.5;
11021 catch(
const EConvertError &ec)
11025 catch(
const Exception &e)
11060 bool ErrorFlag =
false, TooBigFlag =
false;
11081 if(!ErrorFlag && !TooBigFlag)
11091 int KW = (HP * 0.745699872) + 0.5;
11098 int HP = (KW * 1.340482574) + 0.5;
11109 catch(
const EConvertError &ec)
11113 catch(
const Exception &e)
11126 bool ErrorFlag =
false, TooBigFlag =
false;
11147 if(!ErrorFlag && !TooBigFlag)
11157 int KPH = (MPH * 1.609344) + 0.5;
11164 int MPH = (KPH * 0.621371) + 0.5;
11175 catch(
const EConvertError &ec)
11179 catch(
const Exception &e)
11193 bool ErrorFlag =
false, TooLongFlag =
false;
11196 for(
int x = 1; x <=
MileEdit->Text.Length(); x++)
11208 for(
int x = 1; x <=
ChainEdit->Text.Length(); x++)
11220 for(
int x = 1; x <=
YardEdit->Text.Length(); x++)
11232 TooLongFlag =
true;
11235 if(!ErrorFlag && !TooLongFlag)
11237 int Miles = 0, Chains = 0, Yards = 0, Metres = 0;
11250 Metres = int((Miles * 1609.344) + (Chains * 20.1168) + (Yards * 0.9144) + 0.5);
11259 catch(
const EConvertError &ec)
11263 catch(
const Exception &e)
11294 catch(
const Exception &e)
11326 AnsiString Message =
11327 "Changes have been made to the timetable clock - you may wish to save a session before resuming operation.\nTo cancel all changes click 'Adjust the timetable clock' then click the reset button BEFORE resuming operation.";
11328 ShowMessage(Message);
11334 catch(
const Exception &e)
11352 catch(
const Exception &e)
11371 catch(
const Exception &e)
11390 catch(
const Exception &e)
11409 catch(
const Exception &e)
11428 catch(
const Exception &e)
11447 catch(
const Exception &e)
11466 catch(
const Exception &e)
11485 catch(
const Exception &e)
11503 catch(
const Exception &e)
11517 double TTClockIncrement = 1.0 / 24;
11523 catch(
const Exception &e)
11537 double TTClockIncrement = 1.0 / 144;
11543 catch(
const Exception &e)
11557 double TTClockIncrement = 1.0 / 1440;
11563 catch(
const Exception &e)
11604 catch(
const Exception &e)
11618 InfoPanel->Caption =
"PRE-START: Presetting automatic signal routes";
11629 Screen->Cursor = TCursor(-11);
11631 bool PointsChanged, AtLeastOneSet =
false;
11632 int LastIteratorValue = 0;
11639 AtLeastOneSet =
true;
11655 ShowMessage(
"No presettable automatic signal routes are available");
11657 Screen->Cursor = TCursor(-2);
11660 catch(
const Exception &e)
11674 int DispW = (
Interface->Width - 64 - 16) / 16;
11676 int DispH = (
Interface->Height - 192) / 16;
11708 catch(
const Exception &e)
11738 catch(
const Exception &e)
11764 SigImagePanel->Caption =
"Signals will be on the right hand side of the track";
11769 std::ofstream SigFile((
CurDir +
"\\Signal.hnd").c_str());
11772 ShowMessage(
"Failed to store right hand signal setting, program will default to left hand signals when next loaded");
11790 SigImagePanel->Caption =
"Signals will be on the left hand side of the track";
11795 std::ofstream SigFile((
CurDir +
"\\Signal.hnd").c_str());
11807 catch(
const Exception &e)
11826 bool TooBigFlag =
false, BadCharsFlag =
false;
11831 for(
int x = 1; x <=
MTBFEditBox->Text.Length(); x++)
11835 BadCharsFlag =
true;
11848 ShowMessage(
"Maximum value allowed is 10,000");
11857 ShowMessage(
"Value must be a whole number with no special characters");
11874 catch(
const Exception &e)
11892 "Values can only be entered or changed in Pre-Start mode\ni.e. after selecting 'Operate railway' but before clicking 'Run'");
11896 catch(
const Exception &e)
11928 catch(
const Exception &e)
11954 catch(
const Exception &e)
11970 catch(
const Exception &e)
11990 int WidthNum = int(
MainScreen->Width / 160) + 1;
11991 int HeightNum = int(
MainScreen->Height / 144) + 1;
11992 for(
int x = 0; x < WidthNum; x++)
11994 for(
int y = 0; y < HeightNum; y++)
12107 bool BreakFlag =
false;
12189 ZoomButton->Glyph->LoadFromResourceName(0,
"ZoomOut");
12215 InfoPanel->Caption =
"CONNECTING GAPS: Click on connecting element";
12231 UnicodeString MessageStr =
"The railway has changed, close it without saving?";
12232 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
12279 std::ifstream VecFile(FileName);
12281 if(VecFile.is_open())
12301 bool GraphicsFollow =
false;
12302 int NumberOfActiveElements;
12315 if(!(EveryPrefDir->CheckOnePrefDir(0, NumberOfActiveElements, VecFile)))
12346 TDateTime First, Second;
12347 bool Finished =
false;
12349 First = TDateTime::CurrentDateTime();
12350 double TimeVal1 = 86400000 * double(First);
12354 Second = TDateTime::CurrentDateTime();
12355 double TimeVal2 = 86400000 * double(Second);
12356 if((TimeVal2 - TimeVal1) > Msec)
12406 if((LinkNumber1 == 1) || (LinkNumber1 == 3) || (LinkNumber1 == 7) || (LinkNumber1 == 9))
12414 if((LinkNumber2 == 1) || (LinkNumber2 == 3) || (LinkNumber2 == 7) || (LinkNumber2 == 9))
12564 InfoPanel->Caption =
"Select an option from the File, Mode or Help menus";
12718 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Select preferred direction start location (right click to erase)";
12780 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
12794 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
12820 ShowMessage(
"Performance logfile failed to open, logs won't be saved. Ensure that there is a folder named " +
PERFLOG_DIR_NAME +
12821 " in the folder where the 'Railway.exe' program file resides");
12862 OAListBox->Items->Add(L
"to locate train");
12867 OAListBox->Items->Add(L
"Left click and");
12868 OAListBox->Items->Add(L
"hold grey area");
12869 OAListBox->Items->Add(L
"to move panel");
12899 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
12921 OAListBox->Items->Add(L
"to locate train");
12926 OAListBox->Items->Add(L
"Left click and");
12927 OAListBox->Items->Add(L
"hold grey area");
12928 OAListBox->Items->Add(L
"to move panel");
12942 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
12951 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
12988 InfoPanel->Caption =
"ADDING TRACK: Select element then left click to add it. Right click an element to remove it.";
13008 InfoPanel->Caption =
"ADDING GRAPHIC: Left click layout to add SELECTED graphic, right click to remove ANY graphic.";
13013 InfoPanel->Caption =
"SELECTING USER GRAPHIC: Select the graphic file then add as many as necessary to the layout.";
13017 int HLoc, VLoc, Count;
13019 if(div(Count, 2).rem == 1)
13021 ShowMessage(
"Can't connect, there are an odd number of gaps");
13036 ShowMessage(
"Error - Even number of gaps but all set after first call to HighLightOneGap");
13046 InfoPanel->Caption =
"CONNECTING GAPS: Click on connecting gap";
13053 InfoPanel->Caption =
"ADDING/EDITING TEXT: Left click to add, left click first letter to edit (+CR), or remove (+Esc)";
13068 InfoPanel->Caption =
"MOVING TEXT OR GRAPHIC: If text left click first letter, if graphic left click anywhere, then drag";
13075 InfoPanel->Caption =
"NAMING LOCATIONS: Click on location element to add or change name";
13083 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Select first location (only non-default elements marked)";
13094 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Select next location";
13096 InfoPanel->Caption =
"DISTANCE/SPEED SETTING: Continue or set values (overall length), or right click to cancel/truncate";
13108 InfoPanel->Caption =
"SELECTING: Select area - click left mouse && drag";
13118 InfoPanel->Caption =
"COPYING: Left click in selection && drag";
13142 bool EraseSuccessfulFlag, NeedToLink =
false, TextChangesMade =
false, GraphicChangesMade =
false; ;
13143 int ErasedTrackVectorPosition;
13144 Screen->Cursor = TCursor(-11);
13146 InfoPanel->Caption =
"CUT PROCESSING: Please do not click the mouse";
13153 if(EraseSuccessfulFlag)
13155 if(ErasedTrackVectorPosition > -1)
13165 int HighSelectVPos =
SelectRect.bottom * 16;
13171 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
13177 TextChangesMade =
true;
13187 if((GraphicPtr->HPos >= LowSelectHPos) && ((GraphicPtr->HPos + GraphicPtr->Width) < HighSelectHPos) && (GraphicPtr->VPos >= LowSelectVPos)
13188 && ((GraphicPtr->VPos + GraphicPtr->Height) < HighSelectVPos))
13191 GraphicChangesMade =
true;
13198 Screen->Cursor = TCursor(-2);
13203 InfoPanel->Caption =
"CUTTING: Left click in selection && drag";
13219 if(NeedToLink || TextChangesMade || GraphicChangesMade)
13234 bool NeedToLink =
false;
13235 bool TrackLinkingRequiredFlag;
13236 Screen->Cursor = TCursor(-11);
13238 InfoPanel->Caption =
"PASTING: Please wait";
13245 bool TrackEraseSuccessfulFlag;
13246 int ErasedTrackVectorPosition;
13248 for(
int x = LowSelectHLoc; x < HighSelectHLoc; x++)
13250 for(
int y = LowSelectVLoc; y < HighSelectVLoc; y++)
13253 if(ErasedTrackVectorPosition > -1)
13268 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
13283 if((GraphicPtr->HPos >= LowSelectHPos) && ((GraphicPtr->HPos + GraphicPtr->Width) < HighSelectHPos) && (GraphicPtr->VPos >= LowSelectVPos)
13284 && ((GraphicPtr->VPos + GraphicPtr->Height) < HighSelectVPos))
13305 bool InternalChecks =
false;
13309 TrackLinkingRequiredFlag, InternalChecks);
13325 if(TrackLinkingRequiredFlag)
13333 TextPtr->HPos += HDiff * 16;
13334 TextPtr->VPos += VDiff * 16;
13335 AnsiString TempString = TextPtr->TextString;
13351 if(TextPtr->TextString.SubString(1, 4) ==
"##**")
13353 TempString = TextPtr->TextString.SubString(5, TextPtr->TextString.Length());
13356 TextPtr->TextString =
"";
13368 for(TTrack::TUserGraphicVector::iterator GraphicPtr =
Track->
SelectGraphicVector.begin(); GraphicPtr < Track->SelectGraphicVector.end();
13371 GraphicPtr->HPos += HDiff * 16;
13372 GraphicPtr->VPos += VDiff * 16;
13385 Screen->Cursor = TCursor(-2);
13399 UnicodeString MessageStr =
"Selected area will be deleted - proceed?";
13400 int button = Application->MessageBox(MessageStr.c_str(), L
"Please confirm", MB_YESNO);
13405 bool EraseSuccessfulFlag, NeedToLink =
false, TextChangesMade =
false, GraphicChangesMade =
false;
13406 int ErasedTrackVectorPosition;
13407 Screen->Cursor = TCursor(-11);
13409 InfoPanel->Caption =
"DELETING: Please wait";
13416 if(EraseSuccessfulFlag)
13418 if(ErasedTrackVectorPosition > -1)
13428 int HighSelectVPos =
SelectRect.bottom * 16;
13434 AnsiString Check = TextPtr->TextString;
13435 if((TextPtr->HPos >= LowSelectHPos) && (TextPtr->HPos < HighSelectHPos) && (TextPtr->VPos >= LowSelectVPos) && (TextPtr->VPos <
13441 TextChangesMade =
true;
13451 if((GraphicPtr->HPos >= LowSelectHPos) && ((GraphicPtr->HPos + GraphicPtr->Width) < HighSelectHPos) && (GraphicPtr->VPos >= LowSelectVPos)
13452 && ((GraphicPtr->VPos + GraphicPtr->Height) < HighSelectVPos))
13457 if((UserGraphicPtr->HPos == GraphicPtr->HPos) && (UserGraphicPtr->VPos == GraphicPtr->VPos) &&
13458 (UserGraphicPtr->Width == GraphicPtr->Width) && (UserGraphicPtr->Height == GraphicPtr->Height) &&
13459 (UserGraphicPtr->FileName == GraphicPtr->FileName))
13462 GraphicChangesMade =
true;
13479 if(NeedToLink || TextChangesMade || GraphicChangesMade)
13483 Screen->Cursor = TCursor(-2);
13535 bool LeadingPointsAtLastElement =
false;
13538 if(LeadingPointsAtLastElement)
13540 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Can't end on leading points, select next location or truncate";
13545 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Select next preferred direction location (right click to truncate)";
13550 InfoPanel->Caption =
"PREFERRED DIRECTION SETTING: Add selection or select next location (right click to truncate)";
13565 InfoPanel->Caption =
"SELECTING: Select area - click left mouse && drag";
13605 OperateButton->Glyph->LoadFromResourceName(0,
"PauseGraphic");
13648 Display->
PerformanceLog(15, TimeMessage +
"Timetable clock speed changed to one sixteenth normal");
13653 if(TTClockTimeChange > 0.000347)
13656 int MinsIncrease = ((TTClockTimeChange * 1440) + 0.5);
13657 int HoursIncrease = 0;
13658 while(MinsIncrease >= 60)
13661 MinsIncrease -= 60;
13663 if(HoursIncrease == 0)
13664 TimeMessage +=
"Timetable clock incremented by " + AnsiString(MinsIncrease) +
"m";
13665 else if(MinsIncrease == 0)
13666 TimeMessage +=
"Timetable clock incremented by " + AnsiString(HoursIncrease) +
"h";
13668 TimeMessage +=
"Timetable clock incremented by " + AnsiString(HoursIncrease) +
"h " + AnsiString(MinsIncrease) +
"m";
13679 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
13687 MTBFLabel->Caption =
"Mean time between\ntrain failures in\ntimetable hours";
13696 OperateButton->Glyph->LoadFromResourceName(0,
"RunGraphic");
13724 float LockDelay = 120.0;
13730 bool BreakFlag =
false;
13734 if((TTClockTime - LRVIT->LockStartTime) > TDateTime(LockDelay / 86400))
13737 AnsiString(LRVIT->LastTrackVectorPosition));
13738 while(Route.
LastElementPtr(9)->GetTrackVectorPosition() != LRVIT->TruncateTrackVectorPosition)
13751 if(Route.
LastElementPtr(17)->GetTrackVectorPosition() == LRVIT->TruncateTrackVectorPosition)
13790 int TempLockedVectorNumber;
13800 if(((TTClockTime - AutoSigVectorIT->PassoutTime) > TDateTime(AutoSigVectorIT->FirstDelay / 86400)) && (AutoSigVectorIT->AccessNumber == 0))
13803 AutoSigVectorIT->AccessNumber++;
13806 if(((TTClockTime - AutoSigVectorIT->PassoutTime) > TDateTime(AutoSigVectorIT->SecondDelay / 86400)) && (AutoSigVectorIT->AccessNumber == 1))
13809 AutoSigVectorIT->AccessNumber++;
13812 if(((TTClockTime - AutoSigVectorIT->PassoutTime) > TDateTime(AutoSigVectorIT->ThirdDelay / 86400)) && (AutoSigVectorIT->AccessNumber == 2))
13815 AutoSigVectorIT->AccessNumber++;
13823 if(AutoSigVectorIT->AccessNumber > 2)
13838 TPoint MousePoint = Mouse->CursorPos;
13839 int ScreenX = MousePoint.x -
MainScreen->ClientOrigin.x;
13840 int ScreenY = MousePoint.y -
MainScreen->ClientOrigin.y;
13842 if((ScreenX > (
MainScreen->Width - 1)) || (ScreenY > (
MainScreen->Height - 1)) || (ScreenX < 0) || (ScreenY < 0))
13852 ((MousePoint.y - ClientOrigin.y) >=
PerformancePanel->Top) && ((MousePoint.y - ClientOrigin.y) <=
13864 ((MousePoint.y - ClientOrigin.y) >=
OperatorActionPanel->Top) && ((MousePoint.y - ClientOrigin.y) <=
13873 AnsiString TrackFloat =
"", TrainStatusFloat =
"", TrainTTFloat =
"";
13875 bool ShowTrackFloatFlag =
false, ShowTrainStatusFloatFlag =
false, ShowTrainTTFloatFlag =
false;
13887 bool ActiveTrackFoundFlag =
false, InactiveTrackFoundFlag =
false, TwoTrack =
false;
13888 AnsiString Length01Str =
"", Length23Str =
"", SpeedLimit01Str =
"", SpeedLimit23Str =
"";
13889 AnsiString StationEntryStopLinkPos1Str =
"", StationEntryStopLinkPos2Str =
"";
13890 AnsiString ATrackSN =
"", ATrackTN =
"", IATrackSN =
"", LengthAndSpeedCaption =
"";
13891 AnsiString SigAspectString =
"";
13895 if(InactiveTrackFoundFlag)
13900 if(ActiveTrackFoundFlag)
13907 if((ATrackTN !=
"") && (!InactiveTrackFoundFlag || ((InactiveTrackElement.
TrackType !=
Platform) &&
13911 ShowMessage(
"Error - Track has timetable name without corresponding plat/named loc");
13916 ShowMessage(
"Error - plat/named loc and track have different names, or plat/named loc named but not track");
13922 Length01Str = AnsiString(ActiveTrackElement.
Length01);
13923 if(Length01Str ==
"-1")
13924 Length01Str =
"Not Set";
13925 SpeedLimit01Str = AnsiString(ActiveTrackElement.
SpeedLimit01);
13926 if(SpeedLimit01Str ==
"-1")
13927 SpeedLimit01Str =
"Not Set";
13930 Length23Str = AnsiString(ActiveTrackElement.
Length23);
13931 if(Length23Str ==
"-1")
13932 Length23Str =
"Not Set";
13933 SpeedLimit23Str = AnsiString(ActiveTrackElement.
SpeedLimit23);
13934 if(SpeedLimit23Str ==
"-1")
13935 SpeedLimit23Str =
"Not Set";
13938 LengthAndSpeedCaption =
"Straight track length = " + Length01Str +
" m" +
'\n' +
"Diverging track length = " + Length23Str +
" m" +
'\n' +
13939 "Straight track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Diverging track speed limit = " + SpeedLimit23Str +
" km/h";
13943 LengthAndSpeedCaption =
"Left diverging track length = " + Length01Str +
" m" +
'\n' +
"Right diverging track length = " + Length23Str +
13944 " m" +
'\n' +
"Left diverging track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Right diverging track Speed Limit = " +
13945 SpeedLimit23Str +
" km/h";
13950 if((ActiveTrackElement.
SpeedTag == 15) || (ActiveTrackElement.
SpeedTag == 46))
13952 LengthAndSpeedCaption =
"Horizontal track length = " + Length01Str +
" m" +
'\n' +
"Other track length = " + Length23Str +
" m" +
'\n' +
13953 "Horizontal track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit23Str +
" km/h";
13955 else if(ActiveTrackElement.
SpeedTag == 47)
13957 LengthAndSpeedCaption =
"Horizontal track length = " + Length23Str +
" m" +
'\n' +
"Other track length = " + Length01Str +
" m" +
'\n' +
13958 "Horizontal track speed limit = " + SpeedLimit23Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit01Str +
" km/h";
13960 else if(ActiveTrackElement.
SpeedTag == 45)
13962 LengthAndSpeedCaption =
"Vertical track length = " + Length01Str +
" m" +
'\n' +
"Other track length = " + Length23Str +
" m" +
'\n' +
13963 "Vertical track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit23Str +
" km/h";
13965 else if(ActiveTrackElement.
SpeedTag == 44)
13967 LengthAndSpeedCaption =
"Vertical track length = " + Length23Str +
" m" +
'\n' +
"Other track length = " + Length01Str +
" m" +
'\n' +
13968 "Vertical track speed limit = " + SpeedLimit23Str +
" km/h" +
'\n' +
"Other track speed limit = " + SpeedLimit01Str +
" km/h";
13970 else if(ActiveTrackElement.
SpeedTag == 16)
13972 LengthAndSpeedCaption =
"Top left to bottom right track length = " + Length01Str +
" m" +
'\n' +
"Other track length = " + Length23Str +
13973 " m" +
'\n' +
"Top left to bottom right track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Other track speed limit = " +
13974 SpeedLimit23Str +
" km/h";
13979 LengthAndSpeedCaption =
"Top track length = " + Length01Str +
" m" +
'\n' +
"Bottom track length = " + Length23Str +
" m" +
'\n' +
13980 "Top track speed limit = " + SpeedLimit01Str +
" km/h" +
'\n' +
"Bottom track speed limit = " + SpeedLimit23Str +
" km/h";
13985 LengthAndSpeedCaption =
"Track length = " + Length01Str +
" m" +
'\n' +
"Track speed limit = " + SpeedLimit01Str +
" km/h";
13988 if(ActiveTrackFoundFlag)
13992 ShowTrackFloatFlag =
true;
13995 TrackFloat =
"Location = " + ATrackTN +
'\n' + LengthAndSpeedCaption +
'\n' +
"ID = " + AnsiString(ActiveTrackElement.
ElementID);
13997 else if(ATrackSN !=
"")
13999 TrackFloat =
"Location = " + ATrackSN +
'\n' + LengthAndSpeedCaption +
'\n' +
"ID = " + AnsiString(ActiveTrackElement.
ElementID);
14002 else if(InactiveTrackFoundFlag)
14004 TrackFloat =
"Location unnamed\n" + LengthAndSpeedCaption +
'\n' +
"ID = " + AnsiString(ActiveTrackElement.
ElementID);
14009 TrackFloat = LengthAndSpeedCaption +
'\n' +
"Track Element ID = " + AnsiString(ActiveTrackElement.
ElementID);
14015 SigAspectString =
"\nThree-aspect signal";
14019 SigAspectString =
"\nTwo-aspect signal";
14023 SigAspectString =
"\nGround signal";
14027 SigAspectString =
"\nFour-aspect signal";
14029 TrackFloat += SigAspectString;
14032 else if(InactiveTrackFoundFlag)
14035 ShowTrackFloatFlag =
true;
14038 if(IATrackSN ==
"")
14040 TrackFloat =
"Location unnamed\nID = " + AnsiString(InactiveTrackElement.
ElementID);
14044 TrackFloat =
"Location = " + IATrackSN +
'\n' +
"ID = " + AnsiString(InactiveTrackElement.
ElementID);
14049 TrackFloat =
"ID = " + AnsiString(InactiveTrackElement.
ElementID);
14059 AnsiString FormatOneDPStr =
"####0.0";
14060 AnsiString FormatNoDPStr =
"#######0";
14062 AnsiString MaxBrakeStr =
"";
14063 AnsiString SpecialStr =
"", MaxSpeedStr =
"";
14073 ShowTrainStatusFloatFlag =
true;
14074 AnsiString HeadCode =
"", ServiceReferenceInfo =
"", Status =
"", CurrSpeedStr =
"", BrakePCStr =
"", NextStopStr =
"", TimeLeftStr =
"",
14075 TimeToNextMovementStr =
"", MassStr =
"", PowerStr =
"";
14077 MassStr = AnsiString::FormatFloat(FormatNoDPStr, ((
double)Train.
Mass) / 1000);
14078 PowerStr = AnsiString::FormatFloat(FormatNoDPStr, Train.
PowerAtRail / 1000 / 0.8);
14080 MaxSpeedStr =
"30";
14082 MaxSpeedStr = AnsiString::FormatFloat(FormatNoDPStr, Train.
MaxRunningSpeed);
14086 TDateTime TimeLeft;
14088 MaxBrakeStr = AnsiString::FormatFloat(FormatNoDPStr, (Train.
MaxBrakeRate * Train.
Mass / 9810));
14097 ServiceReferenceInfo =
"\nFirst service";
14100 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(Train.
RepeatNumber);
14102 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(Train.
RepeatNumber) +
" of ref. " +
14113 Status =
"Stopped on signaller's instruction";
14115 Status =
"Not in service";
14117 Status =
"Stopped at buffers";
14119 Status =
"Stopped at signal";
14121 Status =
"Stopped - forward track occupied";
14129 Status =
"Stopped without power - train failed";
14131 Status =
"Stopped without power";
14134 Status =
"Stopped - signal passed at danger";
14136 Status =
"Derailed";
14138 Status =
"Crashed";
14145 Status =
"Accelerating";
14152 if(BrakePCRate < 55)
14153 Status =
"Light braking";
14154 else if(BrakePCRate < 90)
14155 Status =
"Heavy braking";
14157 Status =
"Emergency braking";
14163 if(BrakePCRate < 55)
14164 Status =
"Light braking";
14165 else if(BrakePCRate < 90)
14166 Status =
"Heavy braking";
14168 Status =
"Emergency braking";
14174 Status =
"Accelerating";
14180 Status =
"Accelerating";
14182 ((Train.
ExitSpeedFull - Train.
ExitSpeedHalf) * (
double(ElapsedDeltaT - FirstHalfTimeDeltaT) / double(SecondHalfTimeDeltaT)));
14191 Status =
"Coasting - train failed";
14195 Status =
"Coasting - no power";
14201 Status =
"Constant speed";
14212 Status =
"Coasting - train failed";
14216 Status =
"Coasting - no power";
14222 Status =
"Constant speed";
14229 NextStopStr =
"At signaller's discretion";
14231 NextStopStr =
"None";
14237 SpecialStr =
"Train under signaller control" + AnsiString(
'\n');
14241 SpecialStr =
"Restricted speed - being called on" + AnsiString(
'\n');
14245 if(RemTimeHalf < 0)
14248 if(RemTimeFull < 0)
14250 if(RemTimeHalf > 0)
14251 TimeLeft = RemTimeHalf;
14253 TimeLeft = RemTimeFull;
14254 TimeToNextMovementStr =
"Time to next movement (sec) = " + TimeLeftStr.FormatFloat(FormatOneDPStr, TimeLeft);
14256 TimeToNextMovementStr =
"";
14260 MaxSpeedStr +
"km/h; Power " + PowerStr +
"kW" +
'\n' +
"Mass " + MassStr +
"Te; Brakes " + MaxBrakeStr +
"Te" +
'\n' + SpecialStr +
14261 Status +
'\n' +
"Next: " + NextStopStr;
14266 MaxSpeedStr +
"km/h; Power " + PowerStr +
"kW" +
'\n' +
"Mass " + MassStr +
"Te; Brakes " + MaxBrakeStr +
"Te" +
'\n' + SpecialStr +
14267 Status +
": " + CurrSpeedStr.FormatFloat(FormatNoDPStr, CurrSpeed) +
"km/h" +
'\n' +
"Next: " + NextStopStr;
14272 ShowTrainTTFloatFlag =
true;
14281 TrainStatusFloat =
"No trains expected";
14282 TrainTTFloat =
"No timetable";
14286 ShowTrainStatusFloatFlag =
true;
14288 ShowTrainTTFloatFlag =
true;
14295 (CTEIt->second.TrainDataEntryPtr->TrainOperatingDataVector.at(CTEIt->second.RepeatNumber).RunningEntry !=
NotStarted)))
14302 AnsiString ServiceReferenceInfo =
"";
14306 if(CTEIt->second.RepeatNumber == 0)
14309 ServiceReferenceInfo =
"\nFirst service of ref. " + TTDEPtr->
ServiceReference;
14311 ServiceReferenceInfo =
"\nFirst service";
14314 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(CTEIt->second.RepeatNumber);
14316 ServiceReferenceInfo =
"\nRepeat service no. " + AnsiString(CTEIt->second.RepeatNumber) +
" of ref. " +
14322 ServiceReferenceInfo =
"\nService reference " + TTDEPtr->
ServiceReference;
14326 SpecialStr =
"\nTrain under signaller control";
14328 if(EntrySpeed > LineSpeedLimit)
14329 EntrySpeed = LineSpeedLimit;
14334 if(EntrySpeed > LineSpeedLimit)
14335 EntrySpeed = LineSpeedLimit;
14339 TDateTime TempTime = CTEIt->first;
14341 TrainStatusFloat = CTEIt->second.HeadCode +
": " + CTEIt->second.Description + ServiceReferenceInfo +
"\nEntry speed " +
14342 AnsiString::FormatFloat(FormatNoDPStr, EntrySpeed) +
"km/h" + SpecialStr +
"\nDelayed, was due at " +
14347 TDateTime TempTime = CTEIt->first;
14349 TrainStatusFloat = CTEIt->second.HeadCode +
": " + CTEIt->second.Description + ServiceReferenceInfo +
"\nEntry speed " +
14350 AnsiString::FormatFloat(FormatNoDPStr, EntrySpeed) +
"km/h" + SpecialStr +
"\nExpected at " +
14358 CTEIt->second.IncrementalMinutes, CTEIt->second.IncrementalDigits);
14369 AnsiString Caption;
14371 if(!ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
14377 else if(ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
14379 Caption = TrackFloat;
14381 else if(!ShowTrackFloatFlag && ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
14383 Caption = TrainStatusFloat;
14385 else if(ShowTrackFloatFlag && ShowTrainStatusFloatFlag && !ShowTrainTTFloatFlag)
14387 Caption = TrainStatusFloat +
'\n' +
'\n' + TrackFloat;
14389 else if(!ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
14391 if(TrainStatusFloat ==
"No trains expected")
14392 Caption = TrainStatusFloat;
14394 Caption = TrainTTFloat;
14396 else if(ShowTrackFloatFlag && !ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
14398 if(TrainStatusFloat ==
"No trains expected")
14399 Caption = TrainStatusFloat +
'\n' +
'\n' + TrackFloat;
14401 Caption = TrainTTFloat +
'\n' +
'\n' + TrackFloat;
14403 else if(!ShowTrackFloatFlag && ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
14405 if(TrainStatusFloat ==
"No trains expected")
14406 Caption = TrainStatusFloat;
14408 Caption = TrainStatusFloat +
'\n' +
'\n' + TrainTTFloat;
14410 else if(ShowTrackFloatFlag && ShowTrainStatusFloatFlag && ShowTrainTTFloatFlag)
14412 if(TrainStatusFloat ==
"No trains expected")
14413 Caption = TrainStatusFloat +
'\n' +
'\n' + TrackFloat;
14415 Caption = TrainStatusFloat +
'\n' +
'\n' + TrainTTFloat +
'\n' +
'\n' + TrackFloat;
14513 InfoPanel->Caption =
"PRE-START: Route setting in progress";
14515 InfoPanel->Caption =
"OPERATING: Route setting in progress";
14678 throw Exception(
"Failed to find a route at LC position HLoc = " + (AnsiString)H +
" VLoc = " + (AnsiString)V);
14683 if(RouteNumber > -1)
14717 bool SaveRailwayButtonsFlag =
true;
14726 SaveRailwayButtonsFlag =
false;
14743 SaveRailwayButtonsFlag =
false;
14751 SaveRailwayButtonsFlag =
false;
14804 bool ZoomFlag =
true, HomeFlag =
true, NewHomeFlag =
true, ScreenLeftFlag =
true, ScreenRightFlag =
true, ScreenUpFlag =
true, ScreenDownFlag =
true,
14805 TrackBuildPanelEnabledFlag =
true, PrefDirPanelEnabledFlag =
true, OperatingPanelEnabledFlag =
true, TimetablePanelEnabledFlag =
true;
14807 AnsiString TrackBuildPanelLabelCaptionStr =
"Build/modify";
14808 AnsiString PrefDirPanelLabelCaptionStr =
"Preferred direction selection";
14809 AnsiString OperatingPanelLabelCaptionStr =
"Operation";
14810 AnsiString TimetablePanelLabelCaptionStr =
"Timetable editor";
14815 ScreenLeftFlag =
false;
14817 ScreenRightFlag =
false;
14819 ScreenUpFlag =
false;
14821 ScreenDownFlag =
false;
14826 ScreenLeftFlag =
false;
14828 ScreenRightFlag =
false;
14830 ScreenUpFlag =
false;
14832 ScreenDownFlag =
false;
14838 NewHomeFlag =
false;
14839 ScreenLeftFlag =
false;
14840 ScreenRightFlag =
false;
14841 ScreenUpFlag =
false;
14842 ScreenDownFlag =
false;
14848 TrackBuildPanelEnabledFlag =
false;
14849 TrackBuildPanelLabelCaptionStr =
"Disabled";
14850 PrefDirPanelEnabledFlag =
false;
14851 PrefDirPanelLabelCaptionStr =
"Disabled";
14852 OperatingPanelEnabledFlag =
false;
14853 OperatingPanelLabelCaptionStr =
"Disabled";
14854 TimetablePanelEnabledFlag =
false;
14855 TimetablePanelLabelCaptionStr =
"Disabled";
14862 OperatingPanelEnabledFlag =
false;
14863 OperatingPanelLabelCaptionStr =
"Disabled";
14866 NewHomeFlag =
false;
14867 ScreenLeftFlag =
false;
14868 ScreenRightFlag =
false;
14869 ScreenUpFlag =
false;
14870 ScreenDownFlag =
false;
14883 NewHomeFlag =
false;
14884 ScreenLeftFlag =
false;
14885 ScreenRightFlag =
false;
14886 ScreenUpFlag =
false;
14887 ScreenDownFlag =
false;
14894 NewHomeFlag =
false;
14895 ScreenLeftFlag =
false;
14896 ScreenRightFlag =
false;
14897 ScreenUpFlag =
false;
14898 ScreenDownFlag =
false;
14906 NewHomeFlag =
false;
14907 ScreenLeftFlag =
false;
14908 ScreenRightFlag =
false;
14909 ScreenUpFlag =
false;
14910 ScreenDownFlag =
false;
14935 if(ScreenRightFlag)
14947 if(OperatingPanelEnabledFlag)
14951 if(TrackBuildPanelEnabledFlag)
14955 if(PrefDirPanelEnabledFlag)
14959 if(TimetablePanelEnabledFlag)
14978 bool CallOnValid =
false;
14984 CallOnValid =
true;
15069 Screen->Cursor = TCursor(-2);
15112 Caption =
"Railway: New railway under development";
15114 Caption =
"Railway: " +
RailwayTitle +
" under development";
15201 TFont *TempFont =
new TFont;
15203 TempFont->Style.Clear();
15204 TempFont->Name =
"MS Sans Serif";
15205 TempFont->Size = 10;
15207 TempFont->Charset = (TFontCharset)(0);
15313 if(NonPrefDirChangesMade)
15337 AnsiString CurrentDateTimeStr =
"", TimetableTimeStr =
"", SessionFileStr =
"";
15338 Screen->Cursor = TCursor(-11);
15339 CurrentDateTimeStr = TDateTime::CurrentDateTime().FormatString(
"dd-mm-yyyy hh.nn.ss");
15342 TimetableTimeStr = TimetableTimeStr.SubString(1, 2) +
'.' + TimetableTimeStr.SubString(4, 2) +
'.' + TimetableTimeStr.SubString(7, 2);
15345 std::ofstream SessionFile(SessionFileStr.c_str());
15346 if(!(SessionFile.fail()))
15388 SessionFile.close();
15389 DeleteFile(SessionFileStr);
15390 Screen->Cursor = TCursor(-2);
15422 SessionFile.close();
15430 " in the folder where the 'Railway.exe' program file resides");
15432 Screen->Cursor = TCursor(-2);
15435 catch(
const Exception &e)
15464 Screen->Cursor = TCursor(-11);
15469 if(!(SessionFile.fail()))
15476 int LastCharBeforeFloat = TempString.LastDelimiter(
'*');
15477 if((LastCharBeforeFloat == 0) || (LastCharBeforeFloat == TempString.Length()))
15484 AnsiString FloatStr = TempString.SubString(LastCharBeforeFloat + 1, TempString.Length() - LastCharBeforeFloat);
15500 bool GraphicsFollow =
false;
15516 SessionFile.close();
15517 Screen->Cursor = TCursor(-2);
15518 ShowMessage(
"Corruption in preferred direction section of the session file, session can't be loaded");
15526 SessionFile.close();
15527 Screen->Cursor = TCursor(-2);
15528 ShowMessage(
"Corruption in route section of the session file, session can't be loaded");
15540 if(TempString ==
"***BarriersDownVector***")
15548 SessionFile.close();
15549 Screen->Cursor = TCursor(-2);
15550 ShowMessage(
"Unable to load timetable section of the session file, session can't be loaded");
15557 SessionFile.close();
15558 Screen->Cursor = TCursor(-2);
15559 throw Exception(
"TimetableTitle null in LoadSession");
15577 ShowMessage(
"Performance logfile failed to open, logs won't be saved. Ensure that there is a folder named " +
PERFLOG_DIR_NAME +
15578 " in the folder where the 'Railway.exe' program file resides");
15584 SessionFile.get(TempChar);
15585 while(!SessionFile.eof() && ((TempChar ==
'\n') || (TempChar ==
'\0')))
15587 SessionFile.get(TempChar);
15589 if(SessionFile.eof())
15593 SessionFile.close();
15604 double PowerDouble;
15612 SessionFile.close();
15648 ShowMessage(
"Session file integrity check failed, unable to load session.");
15650 Screen->Cursor = TCursor(-2);
15654 catch(
const Exception &e)
15656 if((e.Message.Pos(
"esource") > 0) || (e.Message.Pos(
"arameter") > 0))
15658 Screen->Cursor = TCursor(-2);
15669 UnicodeString MessageStr =
15670 "Insufficient memory available to load the file, and partial load likely to be corrupt. Application will terminate. Try loading the session as the first action after reloading the program.";
15672 Application->MessageBox(MessageStr.c_str(), L
"Out of memory", MB_OK | MB_ICONERROR);
15673 Application->Terminate();
15744 if(OpMode ==
"PreStart")
15802 AnsiString OpMode =
"";
15809 else if((OpMode !=
"PreStart") && (OpMode !=
"NotPreStart"))
16041 SessionFile.close();
16042 SessionFile.open(SessionFileStr.c_str(), std::ios_base::app | std::ios_base::binary);
16056 ShowMessage(
"Failed to open temporary timetable file. Unable to save the session");
16062 char *Buffer =
new char[10000];
16067 BytesRead = FileRead(Handle, Buffer, 10000);
16068 SessionFile.write(Buffer, BytesRead);
16069 if(BytesRead < 10000)
16075 SessionFile.close();
16076 SessionFile.open(SessionFileStr.c_str(), std::ios_base::app | std::ios_base::out);
16100 if(!FileExists(TimetableFileName))
16107 ErrorFile.open(ErrorFileStr.c_str(), std::ios_base::app | std::ios_base::binary);
16109 int Handle = FileOpen(TimetableFileName, fmOpenRead);
16116 Handle = FileOpen(TimetableFileName, fmOpenRead);
16126 char *Buffer =
new char[10000];
16131 BytesRead = FileRead(Handle, Buffer, 10000);
16132 ErrorFile.write(Buffer, BytesRead);
16133 if(BytesRead < 10000)
16140 ErrorFile.open(ErrorFileStr.c_str(), std::ios_base::app | std::ios_base::out);
16168 int TempTTFileNumber = 0;
16170 while(FileExists(
CurDir +
"\\TmpTT" + AnsiString(TempTTFileNumber) +
".tmp"))
16172 TempTTFileNumber++;
16180 if(!TTBFile.fail())
16182 char *Buffer =
new char[10000];
16183 char TempChar = (char)(SessionFile.peek());
16184 if(TempChar ==
'\n')
16185 SessionFile.get(TempChar);
16186 if(!SessionFile.getline(Buffer, 10000,
'\0'))
16195 for(
int x = 0; x < 10000; x++)
16197 if(Buffer[x] !=
'\0')
16202 while(AnsiString(Buffer) !=
"***End***")
16204 TTBFile.write(Buffer, Count);
16205 TTBFile.write(&Zero, 1);
16207 if(!SessionFile.getline(Buffer, 10000,
'\0'))
16216 for(
int x = 0; x < 10000; x++)
16218 if(Buffer[x] !=
'\0')
16228 bool GiveMessagesFalse =
false;
16229 bool CheckLocationsExistInRailwayTrue =
true;
16232 std::ifstream TTBLFile(
TempTTFileName.c_str(), std::ios_base::binary);
16233 if(TTBLFile.is_open())
16235 bool SessionFileTrue =
true;
16266 for(
int x = 0; x < NumberOfTrainEntries; x++)
16274 for(
int y = 0; y < NumberOfTrains; y++)
16299 AnsiString OutString;
16306 while(OutString !=
"***End***")
16315 if(SessionFile.fail())
16320 int NumberOfTrainEntries;
16327 for(
int x = 0; x < NumberOfTrainEntries; x++)
16329 int NumberOfTrains;
16335 for(
int y = 0; y < NumberOfTrains; y++)
16364 bool EndOfFile =
false;
16366 char *TrainTimetableString =
new char[10000];
16370 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
16371 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
16377 AnsiString OneLine(TrainTimetableString);
16378 bool FinalCallTrue =
true;
16380 CheckLocationsExistInRailway))
16382 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
16383 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
16386 throw Exception(
"Timetable FinalCall error - no start time on own line, Count = 0");
16388 OneLine = AnsiString(TrainTimetableString);
16394 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
16395 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
16401 OneLine = AnsiString(TrainTimetableString);
16406 throw Exception(
"Timetable FinalCall error in processing one timetable line, Count = " + AnsiString(Count));
16408 if(EndOfFile && (Count < 2))
16411 throw Exception(
"Timetable FinalCall error - too few or no relevant entries, Count = " + AnsiString(Count));
16416 delete TrainTimetableString;
16423 ShowMessage(
"Timetable secondary integrity check failed - unable to load");
16459 bool EndOfFile =
false;
16461 char *TrainTimetableString =
new char[10000];
16465 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
16466 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
16472 AnsiString OneLine(TrainTimetableString);
16473 bool FinalCallTrue =
true;
16475 CheckLocationsExistInRailway))
16477 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
16478 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
16481 throw Exception(
"Timetable FinalCall error - no start time on own line, Count = 0");
16483 OneLine = AnsiString(TrainTimetableString);
16489 TTBLFile.getline(TrainTimetableString, 10000,
'\0');
16490 if(TTBLFile.eof() && (TrainTimetableString[0] ==
'\0'))
16496 OneLine = AnsiString(TrainTimetableString);
16501 throw Exception(
"Timetable FinalCall error in processing one timetable line, Count = " + AnsiString(Count));
16503 if(EndOfFile && (Count < 2))
16506 throw Exception(
"Timetable FinalCall error - too few or no relevant entries, Count = " + AnsiString(Count));
16511 delete TrainTimetableString;
16543 std::ifstream InFile(FileName.c_str());
16545 int NumberOfActiveElements;
16546 bool GraphicsFollow =
false;
16548 if(InFile.is_open())
16695 if((TempString !=
"***BarriersDownVector***") && (TempString !=
"***Timetable***"))
16701 if(TempString ==
"***BarriersDownVector***")
16739 ShowMessage(
"Session file failed to open, unable to load session. Ensure that there is a folder named " +
SESSION_DIR_NAME +
16740 " in the folder where the 'Railway.exe' program file resides");
16747 InFile.open(FileName.c_str());
16748 if(InFile.is_open())
16769 bool GraphicsFollow =
false;
16890 if((TempString !=
"***BarriersDownVector***") && (TempString !=
"***Timetable***"))
16896 if(TempString ==
"***BarriersDownVector***")
16975 InFile.get(TempChar);
16976 while(!InFile.eof() && ((TempChar ==
'\n') || (TempChar ==
'\0')))
16978 InFile.get(TempChar);
17009 double PowerDouble;
17039 AnsiString TempString =
"", Line1 =
"", Line2 =
"", Line3 =
"", Line4 =
"", Line5 =
"";
17040 char *Buffer =
new char[1000];
17043 InFile.get(TempChar);
17044 InFile.getline(Buffer, 1000);
17045 TempString = AnsiString(Buffer);
17046 while(TempString !=
"***End of performance file***")
17050 InFile.getline(Buffer, 1000);
17051 TempString = AnsiString(Buffer);
17062 AnsiString TempString =
"";
17065 InFile.get(TempChar);
17066 if(TempChar !=
'\n')
17076 while(TempString !=
"***End of performance file***")
17097 AnsiString OneLine = Text.SubString(1, Text.Pos(
'\x0D'));
17098 while((OneLine.Length() > 0) && OneLine[OneLine.Length()] <
' ')
17099 OneLine.SetLength(OneLine.Length() - 1);
17100 Text = Text.SubString(Text.Pos(
'\x0D'), Text.Length());
17101 while((Text.Length() > 0) && Text[1] <
' ')
17102 Text = Text.SubString(2, (Text.Length() - 1));
17103 OutFile << OneLine.c_str() <<
'\n';
17122 InfoPanel->Caption =
"PRE-START: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
17124 InfoPanel->Caption =
"OPERATING: Select AUTOMATIC SIGNAL ROUTE start signal, or left click points to change manually";
17134 InfoPanel->Caption =
"PRE-START: Select PREFERRED ROUTE start signal, or left click points to change manually";
17136 InfoPanel->Caption =
"OPERATING: Select PREFERRED ROUTE start signal, or left click points to change manually";
17146 InfoPanel->Caption =
"PRE-START: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
17148 InfoPanel->Caption =
"OPERATING: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
17159 InfoPanel->Caption =
"PRE-START: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
17161 InfoPanel->Caption =
"OPERATING: Select UNRESTRICTED ROUTE start location, or left click points to change manually";
17187 InfoPanel->Caption =
"Left click screen to zoom in at that position";
17192 InfoPanel->Caption =
"PAUSED: Railway state changes disabled";
17264 Screen->Cursor = TCursor(-11);
17265 AnsiString ErrorFileStr =
CurDir +
"\\errorlog.err";
17266 std::ofstream ErrorFile(ErrorFileStr.c_str());
17268 if(!(ErrorFile.fail()))
17271 int ScreenX = Mouse->CursorPos.x -
MainScreen->ClientOrigin.x;
17272 int ScreenY = Mouse->CursorPos.y -
MainScreen->ClientOrigin.y;
17273 AnsiString MouseStr =
"Posx: " + AnsiString(ScreenX) +
"; Posy: " + AnsiString(ScreenY);
17283 ErrorFile << Item.c_str() <<
'\n';
17290 ErrorFile << Item.c_str() <<
'\n';
17399 Screen->Cursor = TCursor(-2);
17416 int TempTTFileNumber = 0;
17418 while(FileExists(
CurDir +
"\\TmpTT" + AnsiString(TempTTFileNumber) +
".tmp"))
17420 TempTTFileNumber++;
17423 int InHandle = FileOpen(InFileName, fmOpenRead);
17426 while(InHandle < 0)
17428 InHandle = FileOpen(InFileName, fmOpenRead);
17433 ShowMessage(
"Failed to open timetable file, make sure it's not open in another application");
17441 while(OutHandle < 0)
17448 ShowMessage(
"Failed to save temporary timetable file, sessions can't be saved - try again, may only be a temporary problem");
17449 FileClose(InHandle);
17454 int CountIn, CountOut;
17455 char *Buffer =
new char[10000];
17459 CountIn = FileRead(InHandle, Buffer, 10000);
17460 CountOut = FileWrite(OutHandle, Buffer, CountIn);
17461 if(CountOut != CountIn)
17463 ShowMessage(
"Error in writing to the temporary timetable file, sessions can't be saved - try again, may only be a temporary problem");
17465 FileClose(InHandle);
17466 FileClose(OutHandle);
17470 if(CountIn < 10000)
17474 FileClose(InHandle);
17475 FileClose(OutHandle);
17520 int VarElements = 0;
17521 bool NamedLocPresent =
false;
17529 throw Exception(
"Error - failed to find track element at " + AnsiString(TE.
HLoc) +
" & " + AnsiString(TE.
VLoc) +
" in SetLengths");
17536 NamedLocPresent =
true;
17542 if(SpeedLimit != -1)
17547 if(SpeedLimit != -1)
17557 if((NamedLocPresent) && (VarElements > 0) && ((Distance / VarElements) < 50))
17559 ShowMessage(
"Note: Named location elements are quite short. If they are too short the simulation might depart too far from reality.");
17562 if((NamedLocPresent) && (VarElements > 0) && ((Distance / VarElements) > 200))
17564 ShowMessage(
"Note: Named location elements are quite long. If they are too long the simulation might depart too far from reality.");
17573 if((VarElements * 20) > Distance)
17575 ShowMessage(
"Required distance is less than the minimum, will set each element to the minimum (20m)");
17576 Distance = (VarElements * 20);
17578 if(VarElements == 0)
17581 ShowMessage(
"No elements selected");
17587 int RemainingDistance = Distance, RemainingVarElements = VarElements, NextLength = RemainingDistance / VarElements;
17595 if(NextLength < 20)
17619 RemainingDistance -= NextLength;
17620 RemainingVarElements--;
17621 if(RemainingVarElements > 0)
17622 NextLength = RemainingDistance / RemainingVarElements;
17647 ShowMessage(
"Nothing to save!");
17652 SaveRailwayDialog->Filter =
"Development file (*.dev)|*.dev|Railway file (*.rly)|*.rly";
17658 Screen->Cursor = TCursor(-11);
17660 AnsiString Extension =
"";
17668 if(!(VecFile.fail()))
17696 if((LastChar ==
'y') || (LastChar ==
'Y'))
17724 ShowMessage(
"File open failed prior to save");
17728 ShowMessage(
"Can't save: extension must be either '.dev', or '.rly' with railway ready for operation");
17730 Screen->Cursor = TCursor(-2);
17733 ShowMessage(
"File not saved");
17830 bool TextFound =
false;
17853 AnsiString(VPos) +
"," + AnsiString((
short)UseEnteredPosition));
17854 int VPosHi, VPosLo, TextPosHi, TextPosLo;
17857 if(!UseEnteredPosition)
17864 int Depth = abs(Font->Height);
17865 TextPosHi = VPosHi + 20;
17866 TextPosLo = VPosLo - Depth - 4;
17869 if(TextPosLo >= ScreenPosLo)
17871 else if(TextPosHi < ScreenPosHi)
17874 VPos = ScreenPosLo + 288;
17920 catch(
const Exception &e)
17997 AnsiString OpTimeToActDisplay;
17998 AnsiString OpTimeToActString;
17999 AnsiString HeadCode;
18000 float OpTimeToActFloat;
18012 HeadCode = HCandTrainPosParam.first;
18013 if(OpTimeToActFloat < 0.25)
18015 OpTimeToActString =
"NOW";
18017 else if(OpTimeToActFloat < 1)
18019 OpTimeToActString =
"<1";
18023 OpTimeToActString = AnsiString(floor(OpTimeToActFloat));
18025 if(OpTimeToActFloat < 60)
18027 OpTimeToActDisplay = HeadCode + AnsiString(
'\t') + OpTimeToActString;
18028 OAListBox->Items->Add(OpTimeToActDisplay);
18053 TPicture *PicPtr =
new TPicture;
18055 UGME.second = PicPtr;
18066 catch(
const EInvalidGraphic &e)
18069 "Incorrect file format, the file can't be loaded.\nEnsure that the file you want is a valid graphic file with extension .bmp, .gif, .jpg, or .png");
18071 catch(
const Exception &e)